mirror of
https://gitcode.com/JianFeeeee/ModelRouter.git
synced 2026-11-07 09:47:23 +00:00
@ -4386,7 +4386,16 @@ local function syncProviderSource(provider)
|
||||
-- 只在真正要写源时才扫一遍(低频)。
|
||||
do
|
||||
local ls = __llmsproxy_kernel.call("list_sources", {})
|
||||
local arr = (ls and ls.json and ls.json.sources) or (ls and ls.sources) or {}
|
||||
-- ★ 内核 `list_sources` 返回的是**裸数组**(kernel_actions.go 的
|
||||
-- actionListSources 直接 return out),不是 {sources=[...]} 信封。
|
||||
-- 此前这里取 ls.json.sources ⇒ 恒 nil ⇒ 循环一次都不跑 ⇒ 旧版按账号
|
||||
-- 拆的源永远清不掉,同一个渠道的模型于是在列表里出现两遍(靠 12 位
|
||||
-- hex 区分),用户看到的就是"同一个模型两个名字"。
|
||||
-- 三种形态都认,但**裸数组必须优先** —— 它才是内核的现行契约。
|
||||
local arr = ls
|
||||
if type(arr) == "table" and arr.json then arr = arr.json end
|
||||
if type(arr) == "table" and arr.sources then arr = arr.sources end
|
||||
if type(arr) ~= "table" then arr = {} end
|
||||
if type(arr) ~= "table" then arr = {} end
|
||||
local legacyPrefix = "channels-" .. provider .. "-"
|
||||
for _, exist in ipairs(arr) do
|
||||
@ -12882,7 +12891,16 @@ function plugin.__sync_source_probe(args)
|
||||
local found, ad = false, nil
|
||||
-- 一通道一源之后,同步的目标是**通道级**源名;account_id 只用于选号。
|
||||
local want = providerSourceName(args.platform)
|
||||
local arr = (ls and ls.json and ls.json.sources) or (ls and ls.sources) or {}
|
||||
-- ★ 内核 `list_sources` 返回的是**裸数组**(kernel_actions.go 的
|
||||
-- actionListSources 直接 return out),不是 {sources=[...]} 信封。
|
||||
-- 此前这里取 ls.json.sources ⇒ 恒 nil ⇒ 循环一次都不跑 ⇒ 旧版按账号
|
||||
-- 拆的源永远清不掉,同一个渠道的模型于是在列表里出现两遍(靠 12 位
|
||||
-- hex 区分),用户看到的就是"同一个模型两个名字"。
|
||||
-- 三种形态都认,但**裸数组必须优先** —— 它才是内核的现行契约。
|
||||
local arr = ls
|
||||
if type(arr) == "table" and arr.json then arr = arr.json end
|
||||
if type(arr) == "table" and arr.sources then arr = arr.sources end
|
||||
if type(arr) ~= "table" then arr = {} end
|
||||
for _, x in ipairs(arr) do
|
||||
if x.name == want then found = true ad = x.adapter end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user