mirror of
https://gitcode.com/JianFeeeee/HomeAgent.git
synced 2026-10-03 15:53:56 +00:00
lua: 吸收 llmsproxy 适配器高级特性(worker 池/静态预提取/动态签名钩子)
- 适配器 worker 池化:单 LState+全局锁(串行瓶颈)→ 每 adapter 一个 gopher-lua LState 池,按使用该 adapter 的源并发上限求和配置池大小,并发 transform 互不阻塞 - staticInfo 预提取:name/version/endpoint/headers 加载期编译缓存,Endpoint/Headers 读缓存不占 worker;加载即预编译首个 worker - build_headers 动态钩子 + hmac/sha256/base64/tohex 全局:签名型上游(kimicode 等)可接入 - provider applyAdapterHeaders 接入动态头(url/method/body/api_key/timestamp/source 元数据), 未定义时回落静态 headers,缺省补 Authorization - LLMSource.MaxConcurrent + core.llm.sources.<name>.max_concurrent,注册时汇总 VM.ConfigureConcurrency - 新增 Lua VM 测试(load/transform/build_headers/并发) 验证: go test ./... 27 包 0 失败;Windows 交叉编译通过;部署后 9 adapter 全部预加载
This commit is contained in:
@ -185,6 +185,7 @@ var sourceFieldDefs = []struct {
|
||||
{"thinking_enabled", "bool", "深度思考"},
|
||||
{"adapter", "string", "适配器"},
|
||||
{"adapter_path", "string", "适配器路径"},
|
||||
{"max_concurrent", "int", "并发上限"},
|
||||
}
|
||||
|
||||
// registerSourceDefs 注册 core.llm.sources.<name>.* 的 ConfigDef
|
||||
@ -814,6 +815,7 @@ func (r *ConfigRegistry) ToConfig() *types.Config {
|
||||
Adapter: read(p+".adapter", ""),
|
||||
AdapterPath: read(p+".adapter_path", ""),
|
||||
ContextWindow: readInt(p+".context_window", 0),
|
||||
MaxConcurrent: readInt(p+".max_concurrent", 8),
|
||||
ThinkingEnabled: readBool(p+".thinking_enabled", false),
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user