Files
deer-flow/frontend/src/core/artifacts/utils.ts

23 lines
633 B
TypeScript
Raw Normal View History

2026-01-19 11:23:40 +08:00
import { getBackendBaseURL } from "../config";
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
}
export function extractArtifactsFromThread(thread: AgentThread) {
return thread.values.artifacts ?? [];
}
export function resolveArtifactURL(absolutePath: string, threadId: string) {
return `${getBackendBaseURL()}/api/threads/${threadId}/artifacts${absolutePath}`;
}