feat(web): Tool feedback on UI (#1933)
* feat(web): tool feedback * feat(web): tool feedback * fix test
This commit is contained in:
1 parent
69cf9342e1
commit
aa3300c1bd
5 files changed
+57
No files matched your search
@@ -155,6 +155,11 @@ export function ConfigPage() {
|
||||
"Max tool iterations",
|
||||
{ min: 1 },
|
||||
)
|
||||
const toolFeedbackMaxArgsLength = parseIntField(
|
||||
form.toolFeedbackMaxArgsLength,
|
||||
"Tool feedback max args length",
|
||||
{ min: 0 },
|
||||
)
|
||||
const summarizeMessageThreshold = parseIntField(
|
||||
form.summarizeMessageThreshold,
|
||||
"Summarize message threshold",
|
||||
@@ -203,6 +208,10 @@ export function ConfigPage() {
|
||||
defaults: {
|
||||
workspace,
|
||||
restrict_to_workspace: form.restrictToWorkspace,
|
||||
tool_feedback: {
|
||||
enabled: form.toolFeedbackEnabled,
|
||||
max_args_length: toolFeedbackMaxArgsLength,
|
||||
},
|
||||
max_tokens: maxTokens,
|
||||
context_window: contextWindow,
|
||||
max_tool_iterations: maxToolIterations,
|
||||
|
||||
@@ -93,6 +93,33 @@ export function AgentDefaultsSection({
|
||||
}
|
||||
/>
|
||||
|
||||
<SwitchCardField
|
||||
label={t("pages.config.tool_feedback_enabled")}
|
||||
hint={t("pages.config.tool_feedback_enabled_hint")}
|
||||
layout="setting-row"
|
||||
checked={form.toolFeedbackEnabled}
|
||||
onCheckedChange={(checked) =>
|
||||
onFieldChange("toolFeedbackEnabled", checked)
|
||||
}
|
||||
/>
|
||||
|
||||
{form.toolFeedbackEnabled && (
|
||||
<Field
|
||||
label={t("pages.config.tool_feedback_max_args_length")}
|
||||
hint={t("pages.config.tool_feedback_max_args_length_hint")}
|
||||
layout="setting-row"
|
||||
>
|
||||
<Input
|
||||
type="number"
|
||||
min={0}
|
||||
value={form.toolFeedbackMaxArgsLength}
|
||||
onChange={(e) =>
|
||||
onFieldChange("toolFeedbackMaxArgsLength", e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
|
||||
<Field
|
||||
label={t("pages.config.max_tokens")}
|
||||
hint={t("pages.config.max_tokens_hint")}
|
||||
|
||||
@@ -3,6 +3,8 @@ export type JsonRecord = Record<string, unknown>
|
||||
export interface CoreConfigForm {
|
||||
workspace: string
|
||||
restrictToWorkspace: boolean
|
||||
toolFeedbackEnabled: boolean
|
||||
toolFeedbackMaxArgsLength: string
|
||||
execEnabled: boolean
|
||||
allowRemote: boolean
|
||||
enableDenyPatterns: boolean
|
||||
@@ -63,6 +65,8 @@ export const DM_SCOPE_OPTIONS = [
|
||||
export const EMPTY_FORM: CoreConfigForm = {
|
||||
workspace: "",
|
||||
restrictToWorkspace: true,
|
||||
toolFeedbackEnabled: true,
|
||||
toolFeedbackMaxArgsLength: "300",
|
||||
execEnabled: true,
|
||||
allowRemote: true,
|
||||
enableDenyPatterns: true,
|
||||
@@ -124,6 +128,7 @@ export function buildFormFromConfig(config: unknown): CoreConfigForm {
|
||||
const tools = asRecord(root.tools)
|
||||
const cron = asRecord(tools.cron)
|
||||
const exec = asRecord(tools.exec)
|
||||
const toolFeedback = asRecord(defaults.tool_feedback)
|
||||
|
||||
return {
|
||||
workspace: asString(defaults.workspace) || EMPTY_FORM.workspace,
|
||||
@@ -131,6 +136,14 @@ export function buildFormFromConfig(config: unknown): CoreConfigForm {
|
||||
defaults.restrict_to_workspace === undefined
|
||||
? EMPTY_FORM.restrictToWorkspace
|
||||
: asBool(defaults.restrict_to_workspace),
|
||||
toolFeedbackEnabled:
|
||||
toolFeedback.enabled === undefined
|
||||
? EMPTY_FORM.toolFeedbackEnabled
|
||||
: asBool(toolFeedback.enabled),
|
||||
toolFeedbackMaxArgsLength: asNumberString(
|
||||
toolFeedback.max_args_length,
|
||||
EMPTY_FORM.toolFeedbackMaxArgsLength,
|
||||
),
|
||||
execEnabled:
|
||||
exec.enabled === undefined
|
||||
? EMPTY_FORM.execEnabled
|
||||
|
||||
Reference in new issue
Block a user