修正Agent聊天验证口径

前端测试不再用回显用户输入冒充真实回复

Rust LLM provider 测试断言回复不是用户原文
This commit is contained in:
AIGameCreator App
2026-07-09 01:14:44 +08:00
parent 46fbcdf78a
commit 9bcd6d928c
2 changed files with 25 additions and 16 deletions
@@ -956,6 +956,7 @@ async fn chat_with_game_creator_agent_uses_project_context_and_chat_llm_route()
.expect("chat reply");
assert_eq!(reply.reply_text, "可以,我们先把角色规范图定清楚。");
assert_ne!(reply.reply_text, "我要生成一个月光厨师角色图");
let request = receiver
.recv_timeout(Duration::from_secs(1))
.expect("captured chat llm request");
@@ -1033,6 +1034,7 @@ async fn chat_with_game_creator_role_agent_uses_agent_context_and_route() {
.expect("role chat reply");
assert_eq!(reply.reply_text, "可以,我会先收敛角色规范图的视觉方向。");
assert_ne!(reply.reply_text, "我要生成一个开罗风格的 dota");
let request = receiver
.recv_timeout(Duration::from_secs(1))
.expect("captured role chat llm request");
@@ -83,6 +83,13 @@ function emptyProjectPolicy() {
};
}
const roleAgentMockReply =
'专业 Agent 已完成本轮判断:先补齐角色规范图、验收口径和后续生成条件。';
function mockRoleAgentReply() {
return roleAgentMockReply;
}
afterEach(() => {
cleanup();
window.history.pushState({}, '', '/');
@@ -910,7 +917,7 @@ describe('AI 游戏创作 App 界面边界', () => {
}
if (command === 'chat_with_game_creator_role_agent') {
return {
replyText: `Agent 真回复:${String(args?.prompt ?? '')}`,
replyText: mockRoleAgentReply(),
};
}
if (command === 'append_local_conversation_message') {
@@ -959,7 +966,7 @@ describe('AI 游戏创作 App 界面边界', () => {
).not.toBeNull();
expect(
await screen.findByText(
'Agent 真回复:请单独评估这个角色设定流程',
roleAgentMockReply,
),
).not.toBeNull();
expect(invoke).toHaveBeenCalledWith('append_local_conversation_message', {
@@ -976,7 +983,7 @@ describe('AI 游戏创作 App 界面边界', () => {
agentId: 'design-director',
message: {
role: 'assistant',
content: 'Agent 真回复:请单独评估这个角色设定流程',
content: roleAgentMockReply,
agentId: null,
},
});
@@ -1217,7 +1224,7 @@ describe('AI 游戏创作 App 界面边界', () => {
}
if (command === 'chat_with_game_creator_role_agent') {
return {
replyText: `Agent 真回复:${String(args?.prompt ?? '')}`,
replyText: mockRoleAgentReply(),
};
}
if (command === 'append_local_conversation_message') {
@@ -2285,7 +2292,7 @@ describe('AI 游戏创作 App 界面边界', () => {
}
if (command === 'chat_with_game_creator_role_agent') {
return {
replyText: `Agent 真回复:${String(args?.prompt ?? '')}`,
replyText: mockRoleAgentReply(),
};
}
if (command === 'append_local_conversation_message') {
@@ -10649,7 +10656,7 @@ describe('AI 游戏创作 App 界面边界', () => {
}
if (command === 'chat_with_game_creator_role_agent') {
return {
replyText: `Agent 真回复:${String(args?.prompt ?? '')}`,
replyText: mockRoleAgentReply(),
};
}
if (command === 'append_local_conversation_message') {
@@ -11116,7 +11123,7 @@ describe('AI 游戏创作 App 界面边界', () => {
}
if (command === 'chat_with_game_creator_role_agent') {
return {
replyText: `Agent 真回复:${String(args?.prompt ?? '')}`,
replyText: mockRoleAgentReply(),
};
}
if (command === 'append_local_conversation_message') {
@@ -11177,7 +11184,7 @@ describe('AI 游戏创作 App 界面边界', () => {
).not.toBeNull();
expect(
screen.getByText(
'Agent 真回复:优先保留轻量像素风',
roleAgentMockReply,
),
).not.toBeNull();
expect(invoke).toHaveBeenCalledWith('read_local_conversation', {
@@ -11218,7 +11225,7 @@ describe('AI 游戏创作 App 界面边界', () => {
agentId: 'design-director',
message: {
role: 'assistant',
content: 'Agent 真回复:优先保留轻量像素风',
content: roleAgentMockReply,
agentId: null,
},
});
@@ -11577,7 +11584,7 @@ describe('AI 游戏创作 App 界面边界', () => {
}
if (command === 'chat_with_game_creator_role_agent') {
return {
replyText: `Agent 真回复:${String(args?.prompt ?? '')}`,
replyText: mockRoleAgentReply(),
};
}
if (command === 'append_local_conversation_message') {
@@ -11637,7 +11644,7 @@ describe('AI 游戏创作 App 界面边界', () => {
expect(screen.getByText('先记住这个方向')).not.toBeNull();
expect(
screen.getByText(
'Agent 真回复:先记住这个方向',
roleAgentMockReply,
),
).not.toBeNull();
expect(invoke).toHaveBeenCalledWith('append_local_conversation_message', {
@@ -11654,7 +11661,7 @@ describe('AI 游戏创作 App 界面边界', () => {
agentId: 'design-director',
message: {
role: 'assistant',
content: 'Agent 真回复:先记住这个方向',
content: roleAgentMockReply,
agentId: null,
},
});
@@ -11796,7 +11803,7 @@ describe('AI 游戏创作 App 界面边界', () => {
}
if (command === 'chat_with_game_creator_role_agent') {
return {
replyText: `Agent 真回复:${String(args?.prompt ?? '')}`,
replyText: mockRoleAgentReply(),
};
}
if (command === 'append_local_conversation_message') {
@@ -12030,7 +12037,7 @@ describe('AI 游戏创作 App 界面边界', () => {
expect(screen.getByText('先保留这个方向')).not.toBeNull();
expect(
screen.queryByText(
'Agent 真回复:先保留这个方向',
roleAgentMockReply,
),
).toBeNull();
expect(screen.getByLabelText('Agent 对话内容')).toHaveProperty('value', '');
@@ -12142,7 +12149,7 @@ describe('AI 游戏创作 App 界面边界', () => {
}
if (command === 'chat_with_game_creator_role_agent') {
return {
replyText: `Agent 真回复:${String(args?.prompt ?? '')}`,
replyText: mockRoleAgentReply(),
};
}
if (command === 'append_local_conversation_message') {
@@ -12188,7 +12195,7 @@ describe('AI 游戏创作 App 界面边界', () => {
expect(screen.getByText('先记住这个方向')).not.toBeNull();
expect(
screen.getByText(
'Agent 真回复:先记住这个方向',
roleAgentMockReply,
),
).not.toBeNull();
expect(screen.getByLabelText('Agent 对话内容')).toHaveProperty('value', '');