feat: update save-demo

This commit is contained in:
Henry Li
2026-01-24 18:33:30 +08:00
parent 3c40446ade
commit 3ea1dcac11

View File

@@ -4,11 +4,14 @@ import path from "path";
import { env } from "process"; import { env } from "process";
export async function main() { export async function main() {
const threadId = process.argv[2]; const url = new URL(process.argv[2]);
const url = new URL( const threadId = url.pathname.split("/").pop();
`http://localhost:2026/api/langgraph/threads/${threadId}/history`, const host = url.host;
const apiURL = new URL(
`/api/langgraph/threads/${threadId}/history`,
`${url.protocol}//${host}`,
); );
const response = await fetch(url, { const response = await fetch(apiURL, {
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",