feat: integrated with artifacts in states

This commit is contained in:
Henry Li
2026-01-17 17:21:37 +08:00
parent 384353d613
commit f1c6991194
8 changed files with 118 additions and 70 deletions

View File

@@ -1,3 +1,5 @@
import type { AgentThread } from "../threads";
export function urlOfArtifact({
filepath,
threadId,
@@ -9,3 +11,7 @@ export function urlOfArtifact({
}) {
return `http://localhost:8000/api/threads/${threadId}/artifacts${filepath}${download ? "?download=true" : ""}`;
}
export function extractArtifactsFromThread(thread: AgentThread) {
return thread.values.artifacts ?? [];
}

View File

@@ -4,6 +4,7 @@ import type { Thread } from "@langchain/langgraph-sdk";
export interface AgentThreadState extends Record<string, unknown> {
title: string;
messages: BaseMessage[];
artifacts: string[];
}
export interface AgentThread extends Thread<AgentThreadState> {}