更新配置和聊天路由,添加会话中止与分叉功能
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { randomUUID } from "node:crypto";
|
||||
|
||||
import { config } from "../config.js";
|
||||
import { logger } from "../logger.js";
|
||||
|
||||
export type DynamicHttpInput = {
|
||||
path: string;
|
||||
@@ -53,11 +54,24 @@ export class DynamicHttpExecutor {
|
||||
headers.set("x-project-id", context.projectId);
|
||||
}
|
||||
|
||||
const startedAt = Date.now();
|
||||
const response = await fetch(url, {
|
||||
method,
|
||||
headers,
|
||||
signal: AbortSignal.timeout(config.TJWATER_API_TIMEOUT_MS),
|
||||
});
|
||||
const durationMs = Date.now() - startedAt;
|
||||
logger.info(
|
||||
{
|
||||
method,
|
||||
path,
|
||||
statusCode: response.status,
|
||||
durationMs,
|
||||
traceId: context.traceId,
|
||||
projectId: context.projectId,
|
||||
},
|
||||
"dynamic_http_call completed",
|
||||
);
|
||||
|
||||
const contentType = response.headers.get("content-type") ?? "";
|
||||
const rawText = await response.text();
|
||||
|
||||
Reference in New Issue
Block a user