2026-01-19 11:23:40 +08:00
|
|
|
import { getBackendBaseURL } from "../config";
|
2026-01-17 17:21:37 +08:00
|
|
|
import type { AgentThread } from "../threads";
|
|
|
|
|
|
2026-01-17 15:09:44 +08:00
|
|
|
export function urlOfArtifact({
|
|
|
|
|
filepath,
|
|
|
|
|
threadId,
|
|
|
|
|
download = false,
|
|
|
|
|
}: {
|
|
|
|
|
filepath: string;
|
|
|
|
|
threadId: string;
|
|
|
|
|
download?: boolean;
|
|
|
|
|
}) {
|
2026-01-19 11:23:40 +08:00
|
|
|
return `${getBackendBaseURL()}/api/threads/${threadId}/artifacts${filepath}${download ? "?download=true" : ""}`;
|
2026-01-17 15:09:44 +08:00
|
|
|
}
|
2026-01-17 17:21:37 +08:00
|
|
|
|
|
|
|
|
export function extractArtifactsFromThread(thread: AgentThread) {
|
|
|
|
|
return thread.values.artifacts ?? [];
|
|
|
|
|
}
|
2026-01-24 20:58:56 +08:00
|
|
|
|
|
|
|
|
export function resolveArtifactURL(absolutePath: string, threadId: string) {
|
|
|
|
|
return `${getBackendBaseURL()}/api/threads/${threadId}/artifacts${absolutePath}`;
|
|
|
|
|
}
|