Studio: scope artifact IDs by message to prevent cross-turn collisions
This commit is contained in:
parent
9d50f5cd9c
commit
6ff7f42e07
1 changed files with 7 additions and 4 deletions
|
|
@ -43,11 +43,14 @@ export function hashArtifactCode(code: string): string {
|
|||
|
||||
export function createArtifactId(input: ChatArtifactInput): string {
|
||||
const threadSegment = input.threadId || "no-thread";
|
||||
const sourceId =
|
||||
input.sourceToolCallId || input.sourceMessageId || "transient";
|
||||
const parts = [input.source, threadSegment, sourceId];
|
||||
const messageSegment = input.sourceMessageId || "transient";
|
||||
// Backend tool call IDs (call_0, call_1, …) reset per request, so
|
||||
// the message ID is needed to scope them to a specific turn.
|
||||
const parts = [input.source, threadSegment, messageSegment];
|
||||
|
||||
if (input.source !== "tool" || !input.sourceToolCallId) {
|
||||
if (input.source === "tool" && input.sourceToolCallId) {
|
||||
parts.push(input.sourceToolCallId);
|
||||
} else {
|
||||
parts.push(hashArtifactCode(input.code));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue