diff --git a/src/lib/common/modals/StateModal.svelte b/src/lib/common/modals/StateModal.svelte
index ee6fecdb..c489007c 100644
--- a/src/lib/common/modals/StateModal.svelte
+++ b/src/lib/common/modals/StateModal.svelte
@@ -217,7 +217,7 @@
{#if idx === 0}
- {`Key ${validateKey ? '*' : ''}`}
+ {`Name ${validateKey ? '*' : ''}`}
{/if}
void
+ * onSelectAgent?: (detail: { agent: import('$agentTypes').AgentModel | null, template: any, llmConfig: any }) => void
* }}
*/
let {
@@ -45,7 +45,8 @@
name: x.name,
label: x.name,
value: x.name,
- content: x.content
+ content: x.content,
+ llm_config: x.llm_config || null
})) || [];
fireSelectAgent();
@@ -62,7 +63,8 @@
function fireSelectAgent() {
onSelectAgent?.({
agent: selectedAgent || null,
- template: selectedTemplate || null
+ template: selectedTemplate || null,
+ llmConfig: selectedTemplate?.llm_config || selectedAgent?.llm_config || null
});
}
diff --git a/src/routes/page/instruction/instruction-components/instruction-llm.svelte b/src/routes/page/instruction/instruction-components/instruction-llm.svelte
index fb4e02f0..5c2157bb 100644
--- a/src/routes/page/instruction/instruction-components/instruction-llm.svelte
+++ b/src/routes/page/instruction/instruction-components/instruction-llm.svelte
@@ -1,5 +1,7 @@
@@ -92,4 +150,37 @@
onselect={e => selectModel(e)}
/>
+
+
+
+
+ Max output tokens
+
+ validateIntegerInput(e)}
+ onchange={e => changeMaxOutputTokens(e)}
+ />
+
+
+ {#if isReasoningModel}
+
+
+
+ Reasoning level
+
+ selectReasoningEffortLevel(e)}
+ />
+
+ {/if}
\ No newline at end of file
diff --git a/src/routes/page/instruction/instruction-components/instruction-state.svelte b/src/routes/page/instruction/instruction-components/instruction-state.svelte
index 6e250a07..f6b82957 100644
--- a/src/routes/page/instruction/instruction-components/instruction-state.svelte
+++ b/src/routes/page/instruction/instruction-components/instruction-state.svelte
@@ -37,7 +37,7 @@
-
{'Key'}
+
{'Name'}
{'Value'}
diff --git a/src/routes/page/instruction/testing/+page.svelte b/src/routes/page/instruction/testing/+page.svelte
index e167b432..2b11427a 100644
--- a/src/routes/page/instruction/testing/+page.svelte
+++ b/src/routes/page/instruction/testing/+page.svelte
@@ -51,6 +51,12 @@
/** @type {string | null} */
let selectedModel = $state(null);
+ /** @type {string | null} */
+ let selectedReasoningEffortLevel = $state(null);
+
+ /** @type {number | null} */
+ let selectedMaxOutputTokens = $state(null);
+
/** @type {string | null} */
let selectedTemplate = $state(null);
@@ -102,7 +108,14 @@
isThinking = true;
requestDone = false;
elapsedTime = '';
- const formattedStates = formatKeyValues(states);
+ const clonedStates = [
+ { key: 'reasoning_effort_level', value: selectedReasoningEffortLevel ? selectedReasoningEffortLevel : 'disable' }
+ ];
+ if (selectedMaxOutputTokens && selectedMaxOutputTokens > 0) {
+ clonedStates.push({ key: 'max_tokens', value: selectedMaxOutputTokens.toString() });
+ }
+
+ const formattedStates = formatKeyValues(states, clonedStates);
const formatedArgs = formatKeyValues(args);
const start = new Date();
const agentId = selectedAgent?.id || '';
@@ -113,10 +126,10 @@
model: selectedModel,
template: selectedTemplate,
states: formattedStates,
- codeOptions: {
+ codeOptions: selectedCodeScript?.name ? {
script_name: selectedCodeScript?.name,
arguments: formatedArgs
- }
+ } : null
}).then(res => {
result = res?.text || '';
}).finally(() => {
@@ -127,14 +140,20 @@
});
}
- /** @param {import('$commonTypes').KeyValuePair[]} kvs */
- function formatKeyValues(kvs) {
- return kvs?.filter(x => !!util.trim(x.key) && !!util.trim(x.value)).map(x => {
+ /**
+ * @param {import('$commonTypes').KeyValuePair[]} kvs
+ * @param {import('$commonTypes').KeyValuePair[]} [defaults]
+ */
+ function formatKeyValues(kvs, defaults) {
+ const primary = kvs || [];
+ const primaryKeys = new Set(primary.map(x => util.trim(x.key)).filter(k => !!k));
+ const merged = [...(defaults || []).filter(x => !primaryKeys.has(util.trim(x.key))), ...primary];
+ return merged.filter(x => !!util.trim(x.key) && !!util.trim(x.value)).map(x => {
return {
key: util.trim(x.key),
value: util.trim(x.value)
};
- }) || [];
+ });
}
/** @param {KeyboardEvent} e */
@@ -156,7 +175,7 @@
elapsedTime = ''
}
- /** @param {{ agent: import('$agentTypes').AgentModel | null, template: any }} detail */
+ /** @param {{ agent: import('$agentTypes').AgentModel | null, template: any, llmConfig: any }} detail */
function onAgentSelected(detail) {
selectedAgent = detail.agent || null;
let localText = selectedAgent?.instruction;
@@ -168,10 +187,13 @@
}
instruction = localText || '';
- const providerName = selectedAgent?.llm_config?.provider || null;
- const modelName = selectedAgent?.llm_config?.model || null;
+ const llmConfig = detail?.llmConfig || null;
+ const providerName = llmConfig?.provider || null;
+ const modelName = llmConfig?.model || null;
selectedProvider = llmConfigs?.find(x => x.provider === providerName) || null;
selectedModel = modelName;
+ selectedReasoningEffortLevel = llmConfig?.reasoning_effort_level || null;
+ selectedMaxOutputTokens = llmConfig?.max_output_tokens || null;
if (selectedAgent?.id) {
initAgentCodeScripts(selectedAgent.id);
@@ -180,10 +202,12 @@
}
}
- /** @param {{ provider: import('$commonTypes').LlmConfig | null, model: string | null }} detail */
+ /** @param {{ provider: import('$commonTypes').LlmConfig | null, model: string | null, reasoning_effort_level: string | null, max_output_tokens: number | null }} detail */
function onLlmSelected(detail) {
selectedProvider = detail.provider || null;
selectedModel = detail.model || '';
+ selectedReasoningEffortLevel = detail.reasoning_effort_level || null;
+ selectedMaxOutputTokens = detail.max_output_tokens || null;
}
/** @param {string} agentId */
@@ -246,7 +270,7 @@
{/if}
- {text?.length || 0}/{formatNumber(maxLength)}
+ {formatNumber(text?.length || 0)}/{formatNumber(maxLength)}
@@ -378,6 +402,8 @@
disabled={isThinking}
bind:selectedProvider={selectedProvider}
bind:selectedModel={selectedModel}
+ bind:selectedReasoningEffortLevel={selectedReasoningEffortLevel}
+ bind:selectedMaxOutputTokens={selectedMaxOutputTokens}
onSelectLlm={detail => onLlmSelected(detail)}
/>