feat(llm): 每个 LLM 配置支持自定义会话头
新增 session_header_key:非空时每次 LLM 请求带上该 HTTP 头,头值为当前 运行的 session id(chat 会话=conv-<id>,worker=exp<x>-worker-i<intent> 等)。用于某些按 session-id 头做提示缓存/粘性路由的网关。 实现:在已有的 quotaAwareTransport 里从请求 context 读取 session id (transcript.WithSessionID 挂上的)并注入,无需改 norma;同一共享 provider 也能按会话发出不同头值。DB 加 session_header_key 列(带旧库迁移),前端 LLM 配置弹窗新增输入框。
This commit is contained in:
1 parent
b513b656aa
commit
4319fe413f
10 files changed
+166
-36
No files matched your search
@@ -723,6 +723,7 @@ export const api = {
|
||||
streaming?: boolean; // true(默认)=流式 | false=非流式
|
||||
max_tokens?: number; // 单次回复输出上限;0=不发送,由服务端默认值决定
|
||||
max_tokens_field?: string; // ""=max_tokens(默认) | "max_completion_tokens"(仅 openai 格式)
|
||||
session_header_key?: string; // 非空=每次请求带该 HTTP 头,头值=当前会话 session id;""=不发送
|
||||
}) => post<{ id: number }>("/llm/profiles", p),
|
||||
deleteLLMProfile: (id: string) => del<{ deleted: number }>(`/llm/profiles/${id}`),
|
||||
activateLLMProfile: (id: string) => post<{ ok: boolean }>("/llm/profiles/active", { id: Number(id) }),
|
||||
|
||||
@@ -913,6 +913,9 @@ export interface LLMProfile {
|
||||
// 上限用哪个请求字段名,仅 format="openai" 有意义:
|
||||
// ""=max_tokens(默认) | "max_completion_tokens"(OpenAI 推理模型只认它)
|
||||
max_tokens_field?: string;
|
||||
// 自定义会话头名:非空时每次请求带该 HTTP 头,头值=当前会话/意图的 session id。
|
||||
// ""=不发送。用于按 session-id 头做提示缓存/粘性路由的网关。
|
||||
session_header_key?: string;
|
||||
}
|
||||
|
||||
// ---- LLM 轮询(故障转移)----
|
||||
|
||||
Reference in new issue
Block a user