v0.1.4
parent
b1dd8d5e16
commit
753e1053c2
|
|
@ -16,12 +16,6 @@ type AgentTab = 'AGENTS' | 'SOUL' | 'USER' | 'TOOLS' | 'IDENTITY';
|
|||
type ChannelType = 'feishu' | 'qq' | 'dingtalk' | 'telegram' | 'slack';
|
||||
const EMPTY_CHANNEL_PICKER = '__none__';
|
||||
|
||||
const FALLBACK_SOUL_MD = '# Soul\n\n你是专业的企业数字员工,表达清晰、可执行。';
|
||||
const FALLBACK_AGENTS_MD = '# Agent Instructions\n\n- 优先完成任务目标\n- 操作前先说明意图\n- 输出必须可执行\n\n## 默认输出规范\n\n- 每次执行任务时,在 workspace 中创建新目录保存本次输出。\n- 输出内容默认采用 Markdown(.md)格式。';
|
||||
const FALLBACK_USER_MD = '# User\n\n- 语言: 中文\n- 风格: 专业\n- 偏好: 简明且有步骤';
|
||||
const FALLBACK_TOOLS_MD = '# Tools\n\n- 谨慎使用 shell\n- 修改文件后复核\n- 失败时说明原因并重试策略';
|
||||
const FALLBACK_IDENTITY_MD = '# Identity\n\n- 角色: 企业数字员工\n- 领域: 运维与任务执行';
|
||||
|
||||
interface WizardChannelConfig {
|
||||
channel_type: ChannelType;
|
||||
is_active: boolean;
|
||||
|
|
@ -111,11 +105,11 @@ const initialForm = {
|
|||
memory_mb: 1024,
|
||||
storage_gb: 10,
|
||||
|
||||
soul_md: FALLBACK_SOUL_MD,
|
||||
agents_md: FALLBACK_AGENTS_MD,
|
||||
user_md: FALLBACK_USER_MD,
|
||||
tools_md: FALLBACK_TOOLS_MD,
|
||||
identity_md: FALLBACK_IDENTITY_MD,
|
||||
soul_md: '',
|
||||
agents_md: '',
|
||||
user_md: '',
|
||||
tools_md: '',
|
||||
identity_md: '',
|
||||
env_params: {} as Record<string, string>,
|
||||
send_progress: false,
|
||||
send_tool_hints: false,
|
||||
|
|
@ -148,7 +142,7 @@ export function BotWizardModule({ onCreated, onGoDashboard }: BotWizardModulePro
|
|||
const [envVisibleByKey, setEnvVisibleByKey] = useState<Record<string, boolean>>({});
|
||||
const [newChannelType, setNewChannelType] = useState<ChannelType | ''>('');
|
||||
const [form, setForm] = useState(initialForm);
|
||||
const [defaultAgentsTemplate, setDefaultAgentsTemplate] = useState(FALLBACK_AGENTS_MD);
|
||||
const [defaultAgentsTemplate, setDefaultAgentsTemplate] = useState('');
|
||||
const [maxTokensDraft, setMaxTokensDraft] = useState(String(initialForm.max_tokens));
|
||||
const [cpuCoresDraft, setCpuCoresDraft] = useState(String(initialForm.cpu_cores));
|
||||
const [memoryMbDraft, setMemoryMbDraft] = useState(String(initialForm.memory_mb));
|
||||
|
|
@ -179,7 +173,7 @@ export function BotWizardModule({ onCreated, onGoDashboard }: BotWizardModulePro
|
|||
try {
|
||||
const res = await axios.get<SystemDefaultsResponse>(`${APP_ENDPOINTS.apiBase}/system/defaults`);
|
||||
const tpl = res.data?.templates || {};
|
||||
const agentsTemplate = String(tpl.agents_md || '').trim() || FALLBACK_AGENTS_MD;
|
||||
const agentsTemplate = String(tpl.agents_md || '').trim();
|
||||
setDefaultAgentsTemplate(agentsTemplate);
|
||||
setForm((prev) => {
|
||||
return {
|
||||
|
|
@ -192,7 +186,7 @@ export function BotWizardModule({ onCreated, onGoDashboard }: BotWizardModulePro
|
|||
};
|
||||
});
|
||||
} catch {
|
||||
// keep fallback templates
|
||||
// Keep current editor values when defaults are unavailable.
|
||||
}
|
||||
};
|
||||
void loadSystemDefaults();
|
||||
|
|
|
|||
Loading…
Reference in New Issue