feat: add scoped history and artifacts
Generic Container CI/CD / test-build-publish (push) Failing after 8m25s
Agent CI/CD / build-test-publish-and-deploy (push) Failing after 8m25s

This commit is contained in:
2026-10-22 18:40:20 +08:00
parent bc4e9834e5
commit 7d47a2df86
48 changed files with 2632 additions and 78 deletions
+11 -3
View File
@@ -181,8 +181,8 @@ const toLegacyMessages = (messages: UIMessage[]) =>
];
});
const createFallbackUserUiMessage = (content: string): UIMessage => ({
id: `user-${Date.now().toString(36)}`,
const createFallbackUserUiMessage = (content: string, id?: string): UIMessage => ({
id: id ?? `user-${randomUUID()}`,
role: "user",
parts: [{ type: "text", text: content }],
});
@@ -326,6 +326,9 @@ export const registerChatStreamRoute = (
});
return;
}
if (input.tjwater.topic_id && !await sessionMetadataStore.topics.get(authContext, input.tjwater.topic_id)) {
res.status(404).json({ message: "主题不存在" }); return;
}
const requestedSessionId = resolveRequestedStreamSessionId({
sessionId: parsed.data.session_id,
promptText,
@@ -403,6 +406,7 @@ export const registerChatStreamRoute = (
projectId,
projectKey,
sessionId: binding.sessionId,
topicId: existingSessionRecord?.topicId ?? input.tjwater.topic_id,
userId,
});
const activeSessionRecord = await sessionMetadataStore.touch(ensuredSessionRecord);
@@ -454,6 +458,10 @@ export const registerChatStreamRoute = (
toSessionUiStateContext(activeSessionRecord),
);
const persistedUiMessages = toUiMessages(initialSessionState?.messages);
if (input.tjwater.client_message_id && persistedUiMessages.some((message) => message.id === input.tjwater.client_message_id)) {
res.status(409).json({ message: "client_message_id already exists in this conversation" });
return;
}
let executionPlanHistory = initialSessionState?.executionPlans ?? readExecutionPlans(initialSessionState?.messages ?? []);
const visiblePersistedMessages = sessionPurpose === "task_collaboration"
? toCollaborationMessages(persistedUiMessages)
@@ -466,7 +474,7 @@ export const registerChatStreamRoute = (
? visibleRequestMessages
: [
...visiblePersistedMessages,
createFallbackUserUiMessage(promptText),
createFallbackUserUiMessage(promptText, input.tjwater.client_message_id),
];
let latestUiMessages = requestMessages;
const baseMessages = toLegacyMessages(requestMessages);