Files
ai-agent/web/app/dashboard/ai-agents/_components/config-workbench-copy.test.mjs
T
mlogclub 847f688398 Refactor AI Agent configuration and workflow handling
- Removed runtime mode handling from AIAgentConfigWorkbench and related components.
- Updated tests to reflect changes in AI Agent policy copy and configuration.
- Changed terminology from "workflow" to "revision" in various components and API responses.
- Simplified agent binding logic in channel editing.
- Cleaned up unused variables and types related to runtime modes.
- Updated localization files for consistency with new terminology.
2026-07-27 23:29:02 +08:00

42 lines
2.0 KiB
JavaScript

import assert from "node:assert/strict"
import test from "node:test"
import { readFile } from "node:fs/promises"
const configWorkbenchSource = await readFile(new URL("./config-workbench.tsx", import.meta.url), "utf8")
const zhMessagesSource = await readFile(new URL("../../../../messages/zh-CN.json", import.meta.url), "utf8")
const adminApiSource = await readFile(new URL("../../../../lib/api/admin.ts", import.meta.url), "utf8")
const zhMessages = JSON.parse(zhMessagesSource)
test("AI Agent policy copy separates handoff execution from knowledge fallback", () => {
const combinedSource = `${configWorkbenchSource}\n${zhMessagesSource}`
assert.match(combinedSource, /转人工执行方式/)
assert.match(combinedSource, /知识不足回复策略/)
assert.match(combinedSource, /知识不足回复文案/)
assert.match(combinedSource, /AI继续接待并提醒人工/)
assert.match(combinedSource, /直接说明知识不足/)
assert.match(combinedSource, /引导用户补充信息/)
assert.doesNotMatch(configWorkbenchSource, /转人工模式/)
assert.doesNotMatch(configWorkbenchSource, /兜底策略/)
assert.doesNotMatch(configWorkbenchSource, /兜底文案/)
})
test("AI Agent config no longer exposes legacy graph tool routing knobs", () => {
const aiAgentMessages = JSON.stringify(zhMessages.aiAgent ?? {})
assert.doesNotMatch(configWorkbenchSource, /graphTools/)
assert.doesNotMatch(adminApiSource, /graphTools/)
assert.doesNotMatch(aiAgentMessages, /graphTools/)
assert.doesNotMatch(aiAgentMessages, /Graph Tool/)
assert.doesNotMatch(aiAgentMessages, /内置流程/)
})
test("AI Agent config uses one Agent Loop without a runtime mode selector", () => {
assert.doesNotMatch(configWorkbenchSource, /runtimeMode/)
assert.doesNotMatch(adminApiSource, /runtimeMode/)
assert.doesNotMatch(configWorkbenchSource, /运行方式/)
assert.match(configWorkbenchSource, /Workflow 是 Agent 的可选能力/)
assert.match(configWorkbenchSource, /写操作(需确认)/)
})