feat(chatbot): append turn-specific agentsInstruction as a custom message session entry

This commit is contained in:
yiling
2026-07-07 21:51:10 +08:00
parent 985bf0170c
commit 10279d74bc
5 changed files with 63 additions and 3 deletions
@@ -91,6 +91,7 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
const teamId = asset.project.teamId
// 4. Initialize Session if missing
let isNewChat = !payload.agent?.sessionId
if (!sessionId) {
if (!userCommentId) {
throw ApplicationFailure.create({
@@ -104,6 +105,7 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
userCommentId,
userId: payload.agent?.userId,
})
isNewChat = true
}
// 4b. Fetch Agent Context
@@ -151,6 +153,7 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
}
const instruction = new AgentChatPromptBuilder(asset.id)
.withContinuation(!isNewChat)
.withPathContext(pathContext)
.withAssetDetails(asset.name, asset.mediaType, duration)
.withCommentTimestamp(commentTimestamp)