fix: stop chat hang after misrouted themed article requests

Route themed page/article prompts to agent orchestration, reject them
from portal direct chat, and finalize regular sessions to idle when a
direct chat turn already completed.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-07-05 07:30:37 +08:00
parent a29158d589
commit 4781bbc156
5 changed files with 79 additions and 1 deletions
+24
View File
@@ -205,6 +205,30 @@ test('direct chat rejects page generation tasks so the execution backend can han
}), false);
});
test('direct chat rejects themed article page tasks without explicit html path', () => {
const service = createDirectChatService({
enabled: true,
userAuth: {},
llmProviderService: {},
sessionSnapshotService: {},
});
assert.equal(service.canHandle({
toolMode: 'chat',
userMessage: {
role: 'user',
content: [{ type: 'text', text: '帮我写个主题文章' }],
},
}), false);
assert.equal(service.explainCanHandle({
toolMode: 'chat',
userMessage: {
role: 'user',
content: [{ type: 'text', text: '帮我写个主题文章' }],
},
}).reason, 'task_execution_required');
});
test('direct chat allows llm-routed replies on regular agent sessions', () => {
const service = createDirectChatService({
enabled: true,