mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-04-14 03:57:29 +08:00
Refine agent config schema and prompt file loading
This commit is contained in:
@@ -370,14 +370,15 @@ const resources = {
|
||||
keep_recent_messages: 'Keep Recent Messages',
|
||||
max_summary_chars: 'Max Summary Chars',
|
||||
max_transcript_chars: 'Max Transcript Chars',
|
||||
runtime_control: 'Runtime Control',
|
||||
execution: 'Execution',
|
||||
summary_policy: 'Summary Policy',
|
||||
policy: 'Policy',
|
||||
intent_max_input_chars: 'Intent Max Input Chars',
|
||||
autolearn_max_rounds_without_user: 'Autolearn Max Rounds Without User',
|
||||
max_rounds_without_user: 'Max Rounds Without User',
|
||||
run_state_ttl_seconds: 'Run State TTL (Seconds)',
|
||||
run_state_max: 'Run State Max',
|
||||
tool_parallel_safe_names: 'Tool Parallel Safe Names',
|
||||
tool_max_parallel_calls: 'Tool Max Parallel Calls',
|
||||
system_summary: 'System Summary',
|
||||
marker: 'Summary Marker',
|
||||
completed_prefix: 'Completed Prefix',
|
||||
changes_prefix: 'Changes Prefix',
|
||||
@@ -795,14 +796,15 @@ const resources = {
|
||||
keep_recent_messages: '保留最近消息数',
|
||||
max_summary_chars: '摘要最大字符数',
|
||||
max_transcript_chars: '转录最大字符数',
|
||||
runtime_control: '运行时控制',
|
||||
execution: '执行控制',
|
||||
summary_policy: '摘要策略',
|
||||
policy: '策略',
|
||||
intent_max_input_chars: '意图输入最大字符数',
|
||||
autolearn_max_rounds_without_user: '自学习无用户最大轮数',
|
||||
max_rounds_without_user: '无用户最大轮数',
|
||||
run_state_ttl_seconds: '运行状态 TTL(秒)',
|
||||
run_state_max: '运行状态上限',
|
||||
tool_parallel_safe_names: '工具并行安全名单',
|
||||
tool_max_parallel_calls: '工具最大并行调用数',
|
||||
system_summary: '系统摘要',
|
||||
marker: '摘要标记',
|
||||
completed_prefix: '完成前缀',
|
||||
changes_prefix: '变更前缀',
|
||||
|
||||
@@ -66,6 +66,7 @@ type PendingSubagentDraft = {
|
||||
display_name?: string;
|
||||
description?: string;
|
||||
system_prompt?: string;
|
||||
system_prompt_file?: string;
|
||||
tool_allowlist?: string[];
|
||||
routing_keywords?: string[];
|
||||
};
|
||||
@@ -79,6 +80,7 @@ type RegistrySubagent = {
|
||||
role?: string;
|
||||
description?: string;
|
||||
system_prompt?: string;
|
||||
system_prompt_file?: string;
|
||||
memory_namespace?: string;
|
||||
tool_allowlist?: string[];
|
||||
routing_keywords?: string[];
|
||||
@@ -111,6 +113,7 @@ const Subagents: React.FC = () => {
|
||||
const [configRole, setConfigRole] = useState('');
|
||||
const [configDisplayName, setConfigDisplayName] = useState('');
|
||||
const [configSystemPrompt, setConfigSystemPrompt] = useState('');
|
||||
const [configSystemPromptFile, setConfigSystemPromptFile] = useState('');
|
||||
const [configToolAllowlist, setConfigToolAllowlist] = useState('');
|
||||
const [configRoutingKeywords, setConfigRoutingKeywords] = useState('');
|
||||
const [draftDescription, setDraftDescription] = useState('');
|
||||
@@ -284,6 +287,7 @@ const Subagents: React.FC = () => {
|
||||
role: configRole,
|
||||
display_name: configDisplayName,
|
||||
system_prompt: configSystemPrompt,
|
||||
system_prompt_file: configSystemPromptFile,
|
||||
tool_allowlist: toolAllowlist,
|
||||
routing_keywords: routingKeywords,
|
||||
});
|
||||
@@ -293,6 +297,7 @@ const Subagents: React.FC = () => {
|
||||
setConfigRole('');
|
||||
setConfigDisplayName('');
|
||||
setConfigSystemPrompt('');
|
||||
setConfigSystemPromptFile('');
|
||||
setConfigToolAllowlist('');
|
||||
setConfigRoutingKeywords('');
|
||||
await load();
|
||||
@@ -314,6 +319,7 @@ const Subagents: React.FC = () => {
|
||||
setConfigRole(draft.role || '');
|
||||
setConfigDisplayName(draft.display_name || '');
|
||||
setConfigSystemPrompt(draft.system_prompt || '');
|
||||
setConfigSystemPromptFile(draft.system_prompt_file || '');
|
||||
setConfigToolAllowlist(Array.isArray(draft.tool_allowlist) ? draft.tool_allowlist.join(', ') : '');
|
||||
setConfigRoutingKeywords(Array.isArray(draft.routing_keywords) ? draft.routing_keywords.join(', ') : '');
|
||||
await load();
|
||||
@@ -347,6 +353,7 @@ const Subagents: React.FC = () => {
|
||||
setConfigRole(item.role || '');
|
||||
setConfigDisplayName(item.display_name || '');
|
||||
setConfigSystemPrompt(item.system_prompt || '');
|
||||
setConfigSystemPromptFile((item as any).system_prompt_file || '');
|
||||
setConfigToolAllowlist(Array.isArray(item.tool_allowlist) ? item.tool_allowlist.join(', ') : '');
|
||||
setConfigRoutingKeywords(Array.isArray(item.routing_keywords) ? item.routing_keywords.join(', ') : '');
|
||||
};
|
||||
@@ -500,6 +507,7 @@ const Subagents: React.FC = () => {
|
||||
placeholder="system_prompt"
|
||||
className="w-full px-2 py-1 text-xs bg-zinc-900 border border-zinc-700 rounded min-h-[96px]"
|
||||
/>
|
||||
<input value={configSystemPromptFile} onChange={(e) => setConfigSystemPromptFile(e.target.value)} placeholder="system_prompt_file (relative AGENT.md path)" className="w-full px-2 py-1 text-xs bg-zinc-900 border border-zinc-700 rounded" />
|
||||
<input value={configToolAllowlist} onChange={(e) => setConfigToolAllowlist(e.target.value)} placeholder="tool_allowlist (comma separated)" className="w-full px-2 py-1 text-xs bg-zinc-900 border border-zinc-700 rounded" />
|
||||
<input value={configRoutingKeywords} onChange={(e) => setConfigRoutingKeywords(e.target.value)} placeholder="routing_keywords (comma separated)" className="w-full px-2 py-1 text-xs bg-zinc-900 border border-zinc-700 rounded" />
|
||||
<button onClick={upsertConfigSubagent} className="px-3 py-1.5 text-xs rounded bg-amber-700/80 hover:bg-amber-600">{t('saveToConfig')}</button>
|
||||
|
||||
Reference in New Issue
Block a user