mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-07-02 02:22:55 +08:00
fix: pass effort through external agent api
This commit is contained in:
@@ -489,7 +489,7 @@
|
|||||||
<span class="endpoint-path"><span class="api-url">http://localhost:3001</span>/api/agent</span>
|
<span class="endpoint-path"><span class="api-url">http://localhost:3001</span>/api/agent</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>Trigger an AI agent (Claude, Cursor, or Codex) to work on a project.</p>
|
<p>Trigger an AI agent (Claude, Cursor, Codex, Gemini, or OpenCode) to work on a project.</p>
|
||||||
|
|
||||||
<h4>Request Body Parameters</h4>
|
<h4>Request Body Parameters</h4>
|
||||||
<table>
|
<table>
|
||||||
@@ -524,7 +524,7 @@
|
|||||||
<td><code>provider</code></td>
|
<td><code>provider</code></td>
|
||||||
<td>string</td>
|
<td>string</td>
|
||||||
<td><span class="badge badge-optional">Optional</span></td>
|
<td><span class="badge badge-optional">Optional</span></td>
|
||||||
<td><code>claude</code>, <code>cursor</code>, or <code>codex</code> (default: <code>claude</code>)</td>
|
<td><code>claude</code>, <code>cursor</code>, <code>codex</code>, <code>gemini</code>, or <code>opencode</code> (default: <code>claude</code>)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>stream</code></td>
|
<td><code>stream</code></td>
|
||||||
@@ -540,6 +540,12 @@
|
|||||||
Model identifier for the AI provider (loading from constants...)
|
Model identifier for the AI provider (loading from constants...)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>effort</code></td>
|
||||||
|
<td>string</td>
|
||||||
|
<td><span class="badge badge-optional">Optional</span></td>
|
||||||
|
<td>Reasoning effort for Claude and Codex models that expose effort metadata. Use <code>default</code> or omit it to let the provider decide.</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>cleanup</code></td>
|
<td><code>cleanup</code></td>
|
||||||
<td>boolean</td>
|
<td>boolean</td>
|
||||||
|
|||||||
@@ -646,12 +646,17 @@ class ResponseCollector {
|
|||||||
*
|
*
|
||||||
* @param {string} model - (Optional) Model identifier for providers.
|
* @param {string} model - (Optional) Model identifier for providers.
|
||||||
*
|
*
|
||||||
* Claude models: 'sonnet' (default), 'opus', 'haiku', 'opusplan', 'sonnet[1m]', 'fable'
|
* Claude models: 'default', 'sonnet', 'opus', 'haiku', 'sonnet[1m]', 'opus[1m]', 'fable'
|
||||||
* Cursor models: 'gpt-5' (default), 'gpt-5.2', 'gpt-5.2-high', 'sonnet-4.5', 'opus-4.5',
|
* Cursor models: 'gpt-5' (default), 'gpt-5.2', 'gpt-5.2-high', 'sonnet-4.5', 'opus-4.5',
|
||||||
* 'gemini-3-pro', 'composer-1', 'auto', 'gpt-5.1', 'gpt-5.1-high',
|
* 'gemini-3-pro', 'composer-1', 'auto', 'gpt-5.1', 'gpt-5.1-high',
|
||||||
* 'gpt-5.1-codex', 'gpt-5.1-codex-high', 'gpt-5.1-codex-max',
|
* 'gpt-5.1-codex', 'gpt-5.1-codex-high', 'gpt-5.1-codex-max',
|
||||||
* 'gpt-5.1-codex-max-high', 'opus-4.1', 'grok', and thinking variants
|
* 'gpt-5.1-codex-max-high', 'opus-4.1', 'grok', and thinking variants
|
||||||
* Codex models: 'gpt-5.2' (default), 'gpt-5.1-codex-max', 'o3', 'o4-mini'
|
* Codex models: 'gpt-5.4' (default), 'gpt-5.5', 'gpt-5.4-mini', 'gpt-5.3-codex', 'gpt-5.2'
|
||||||
|
*
|
||||||
|
* @param {string} effort - (Optional) Reasoning effort for providers/models that support it.
|
||||||
|
* Claude supports: 'low', 'medium', 'high', 'xhigh', 'max' depending on model.
|
||||||
|
* Codex supports: 'low', 'medium', 'high', 'xhigh'.
|
||||||
|
* 'default' or omission lets the provider decide.
|
||||||
*
|
*
|
||||||
* @param {boolean} cleanup - (Optional) Auto-cleanup project directory after completion.
|
* @param {boolean} cleanup - (Optional) Auto-cleanup project directory after completion.
|
||||||
* Default: true
|
* Default: true
|
||||||
@@ -844,6 +849,9 @@ class ResponseCollector {
|
|||||||
*/
|
*/
|
||||||
router.post('/', validateExternalApiKey, async (req, res) => {
|
router.post('/', validateExternalApiKey, async (req, res) => {
|
||||||
const { githubUrl, projectPath, message, provider = 'claude', model, githubToken, branchName, sessionId } = req.body;
|
const { githubUrl, projectPath, message, provider = 'claude', model, githubToken, branchName, sessionId } = req.body;
|
||||||
|
const effort = typeof req.body.effort === 'string' && req.body.effort.trim()
|
||||||
|
? req.body.effort.trim()
|
||||||
|
: undefined;
|
||||||
|
|
||||||
// Parse stream and cleanup as booleans (handle string "true"/"false" from curl)
|
// Parse stream and cleanup as booleans (handle string "true"/"false" from curl)
|
||||||
const stream = req.body.stream === undefined ? true : (req.body.stream === true || req.body.stream === 'true');
|
const stream = req.body.stream === undefined ? true : (req.body.stream === true || req.body.stream === 'true');
|
||||||
@@ -954,6 +962,7 @@ router.post('/', validateExternalApiKey, async (req, res) => {
|
|||||||
cwd: finalProjectPath,
|
cwd: finalProjectPath,
|
||||||
sessionId: sessionId || null,
|
sessionId: sessionId || null,
|
||||||
model: model,
|
model: model,
|
||||||
|
effort,
|
||||||
permissionMode: 'bypassPermissions' // Bypass all permissions for API calls
|
permissionMode: 'bypassPermissions' // Bypass all permissions for API calls
|
||||||
}, writer);
|
}, writer);
|
||||||
|
|
||||||
@@ -975,6 +984,7 @@ router.post('/', validateExternalApiKey, async (req, res) => {
|
|||||||
cwd: finalProjectPath,
|
cwd: finalProjectPath,
|
||||||
sessionId: sessionId || null,
|
sessionId: sessionId || null,
|
||||||
model: model || codexModels.DEFAULT,
|
model: model || codexModels.DEFAULT,
|
||||||
|
effort,
|
||||||
permissionMode: 'bypassPermissions'
|
permissionMode: 'bypassPermissions'
|
||||||
}, writer);
|
}, writer);
|
||||||
} else if (provider === 'gemini') {
|
} else if (provider === 'gemini') {
|
||||||
|
|||||||
Reference in New Issue
Block a user