@ai-wendao/ant 0.5.3 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client.js +193 -28
- package/conversation.js +3 -1
- package/delegation.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -220,6 +220,16 @@ window.__ModuleLoader__.load({
|
|
|
220
220
|
}
|
|
221
221
|
return false
|
|
222
222
|
}
|
|
223
|
+
function safeInstallDiagnostic(value) {
|
|
224
|
+
const text = typeof value === 'string' ? value
|
|
225
|
+
: [value?.name, value?.code, value?.message].filter((part) => part != null).join(' ')
|
|
226
|
+
return String(text || '')
|
|
227
|
+
.replace(/\b(Bearer|Basic)\s+[^\s,;]+/giu, '$1 [REDACTED]')
|
|
228
|
+
.replace(/([?&](?:access[_-]?token|refresh[_-]?token|token|api[_-]?key|secret|password|signature|authorization)=)[^&#\s]*/giu, '$1[REDACTED]')
|
|
229
|
+
.replace(/(["']?(?:access[_-]?token|refresh[_-]?token|token|api[_-]?key|client[_-]?secret|secret|password|authorization)["']?\s*[:=]\s*["']?)[^,"';\s}]+/giu, '$1[REDACTED]')
|
|
230
|
+
.replace(/(https?:\/\/)[^/\s?#@]+:[^@\s/]+@/giu, '$1[REDACTED]@')
|
|
231
|
+
.slice(0, 180)
|
|
232
|
+
}
|
|
223
233
|
const inject = ['slots', 'layout', 'pluginNavigation', 'remote', 'remote.credentials', 'remote.settings', 'remote.pluginManager']
|
|
224
234
|
|
|
225
235
|
async function readLocalJsonResponse(response) {
|
|
@@ -1844,6 +1854,9 @@ window.__ModuleLoader__.load({
|
|
|
1844
1854
|
}
|
|
1845
1855
|
const local = bundles.find((bundle) => bundle.name === plugin.package_name && bundle.installed)
|
|
1846
1856
|
const localAhead = local?.version && newerVersion(local.version, plugin.version)
|
|
1857
|
+
const updatingInstalled = Boolean(local?.version && local.version !== plugin.version)
|
|
1858
|
+
const replacingInstalled = Boolean(local?.version && (updatingInstalled
|
|
1859
|
+
|| artifactUrl && local.source !== artifactUrl))
|
|
1847
1860
|
const action = localAhead ? '回退到团队版本' : local ? local.version === plugin.version ? '重新安装' : '更新' : '安装'
|
|
1848
1861
|
const sourceNotice = artifactUrl
|
|
1849
1862
|
? 'DSH 将安装 ANT 固定的顶层制品。'
|
|
@@ -1862,23 +1875,128 @@ window.__ModuleLoader__.load({
|
|
|
1862
1875
|
throw new Error('插件审核信息已变化,请刷新目录后重试。')
|
|
1863
1876
|
}
|
|
1864
1877
|
const requestId = crypto.randomUUID()
|
|
1878
|
+
const requestReference = requestId.slice(0, 8).toUpperCase()
|
|
1879
|
+
const previousSourceIsRegistry = Boolean(local && (!local.source
|
|
1880
|
+
|| local.source === plugin.package_name || local.source.startsWith(`${plugin.package_name}@`)))
|
|
1881
|
+
const previousInstallSpec = local
|
|
1882
|
+
? previousSourceIsRegistry ? `${plugin.package_name}@${local.version}` : local.source || ''
|
|
1883
|
+
: ''
|
|
1884
|
+
const expectedPreviousSource = previousSourceIsRegistry ? previousInstallSpec : local?.source
|
|
1885
|
+
const previousRegistry = previousSourceIsRegistry ? 'https://registry.npmjs.org/' : null
|
|
1886
|
+
const currentBundle = async () => {
|
|
1887
|
+
try {
|
|
1888
|
+
const listed = await manager.listBundles()
|
|
1889
|
+
if (listed.ok && Array.isArray(listed.value)) {
|
|
1890
|
+
return listed.value.find((bundle) => bundle.name === plugin.package_name && bundle.installed) || null
|
|
1891
|
+
}
|
|
1892
|
+
} catch {}
|
|
1893
|
+
return undefined
|
|
1894
|
+
}
|
|
1895
|
+
const isPreviousVersion = (bundle) => bundle?.version === local?.version
|
|
1896
|
+
&& (!expectedPreviousSource || bundle.source === expectedPreviousSource)
|
|
1897
|
+
const restorePreviousVersion = async () => {
|
|
1898
|
+
let installed = await currentBundle()
|
|
1899
|
+
if (installed === undefined) return 'unknown'
|
|
1900
|
+
if (isPreviousVersion(installed)) {
|
|
1901
|
+
if (installed.enabled === (local.enabled !== false)) return 'restored'
|
|
1902
|
+
if (typeof manager.setBundleEnabled !== 'function') return 'unknown'
|
|
1903
|
+
try {
|
|
1904
|
+
await manager.setBundleEnabled(plugin.package_name, local.enabled !== false)
|
|
1905
|
+
} catch {}
|
|
1906
|
+
installed = await currentBundle()
|
|
1907
|
+
return isPreviousVersion(installed) && installed.enabled === (local.enabled !== false)
|
|
1908
|
+
? 'restored' : 'unknown'
|
|
1909
|
+
}
|
|
1910
|
+
if (installed?.installed) {
|
|
1911
|
+
return installed.version === plugin.version
|
|
1912
|
+
&& (!artifactUrl || installed.source === artifactUrl) ? 'target' : 'unknown'
|
|
1913
|
+
}
|
|
1914
|
+
if (installed !== null || !previousInstallSpec) return 'unknown'
|
|
1915
|
+
if (previousSourceIsRegistry && !previousRegistry) return 'unknown'
|
|
1916
|
+
const restoreRequestId = crypto.randomUUID()
|
|
1917
|
+
try {
|
|
1918
|
+
const restoreOptions = {
|
|
1919
|
+
enabled: local.enabled !== false, requestId: restoreRequestId,
|
|
1920
|
+
saveExact: true,
|
|
1921
|
+
}
|
|
1922
|
+
if (previousSourceIsRegistry && previousRegistry) restoreOptions.registry = previousRegistry
|
|
1923
|
+
await manager.installBundle(previousInstallSpec, restoreOptions)
|
|
1924
|
+
if (typeof manager.waitForInstall === 'function') {
|
|
1925
|
+
await manager.waitForInstall(restoreRequestId)
|
|
1926
|
+
}
|
|
1927
|
+
} catch {}
|
|
1928
|
+
installed = await currentBundle()
|
|
1929
|
+
return isPreviousVersion(installed) && installed.enabled === (local.enabled !== false)
|
|
1930
|
+
? 'restored' : 'unknown'
|
|
1931
|
+
}
|
|
1865
1932
|
let result
|
|
1933
|
+
let installFailure = null
|
|
1934
|
+
let updateRestore = null
|
|
1935
|
+
let removedForUpdate = false
|
|
1866
1936
|
const options = artifactUrl
|
|
1867
|
-
? { enabled: true, requestId }
|
|
1868
|
-
: { enabled: true, requestId, registry: 'https://registry.npmjs.org/' }
|
|
1869
|
-
|
|
1870
|
-
|
|
1937
|
+
? { enabled: local ? local.enabled !== false : true, requestId }
|
|
1938
|
+
: { enabled: local ? local.enabled !== false : true, requestId, registry: 'https://registry.npmjs.org/' }
|
|
1939
|
+
if (replacingInstalled && !localAhead && !artifactUrl && local.updatable !== false
|
|
1940
|
+
&& typeof manager.updateBundle === 'function') {
|
|
1941
|
+
try {
|
|
1942
|
+
const update = await manager.updateBundle(plugin.package_name, plugin.version, {
|
|
1943
|
+
requestId, registry: 'https://registry.npmjs.org/',
|
|
1944
|
+
})
|
|
1945
|
+
result = { ok: true, value: update?.result }
|
|
1946
|
+
updateRestore = update?.restore || null
|
|
1947
|
+
} catch (error) { installFailure = error; result = null }
|
|
1948
|
+
} else {
|
|
1949
|
+
if (replacingInstalled && typeof manager.removeBundle !== 'function') {
|
|
1950
|
+
setMessage('当前 DSH 不支持通过 ANT 安全替换已安装插件。请在 DSH 插件管理查看状态,或联系管理员。')
|
|
1951
|
+
return
|
|
1952
|
+
}
|
|
1953
|
+
if (replacingInstalled) {
|
|
1954
|
+
let removed = null
|
|
1955
|
+
let removeFailure = null
|
|
1956
|
+
try { removed = await manager.removeBundle(plugin.package_name) }
|
|
1957
|
+
catch (error) { removeFailure = error }
|
|
1958
|
+
if (!removed?.ok || !['applied', 'restart-required'].includes(removed.value?.application)) {
|
|
1959
|
+
const diagnostic = safeInstallDiagnostic(removed?.value?.error || removed?.error || removeFailure)
|
|
1960
|
+
const recovery = await restorePreviousVersion()
|
|
1961
|
+
if (recovery !== 'restored') setUncertainId(plugin.id)
|
|
1962
|
+
const recoveryNotice = recovery === 'restored'
|
|
1963
|
+
? `旧版本号和原启用状态已恢复。${previousSourceIsRegistry ? '恢复按团队目录使用 npm 官方源;若此前来自私有源,请联系管理员核对。' : ''}`
|
|
1964
|
+
: recovery === 'target' ? `本机列表显示审核版本 ${plugin.version} 已安装,请核对后再操作。`
|
|
1965
|
+
: '无法确认旧版本及启用状态,请先在 DSH 插件管理核对。'
|
|
1966
|
+
setMessage(`无法开始更新 ${plugin.title}:DSH 未能确认旧版本移除完成。${diagnostic
|
|
1967
|
+
? `DSH 诊断:${diagnostic}。` : ''}${recoveryNotice}`)
|
|
1968
|
+
return
|
|
1969
|
+
}
|
|
1970
|
+
removedForUpdate = true
|
|
1971
|
+
}
|
|
1972
|
+
try { result = await manager.installBundle(installSpec, options) }
|
|
1973
|
+
catch (error) { installFailure = error; result = null }
|
|
1974
|
+
}
|
|
1871
1975
|
if (!result?.ok) {
|
|
1976
|
+
if (!installFailure && result?.error) installFailure = result.error
|
|
1872
1977
|
let recovered = null
|
|
1978
|
+
let waitFailure = null
|
|
1873
1979
|
if (typeof manager.waitForInstall === 'function') {
|
|
1874
1980
|
try {
|
|
1875
1981
|
const pending = await manager.waitForInstall(requestId)
|
|
1876
1982
|
if (pending.ok && pending.value) recovered = { ok: true, value: pending.value }
|
|
1877
|
-
|
|
1983
|
+
else if (pending?.error) waitFailure = pending.error
|
|
1984
|
+
} catch (error) { waitFailure = error }
|
|
1878
1985
|
}
|
|
1879
1986
|
if (!recovered) {
|
|
1880
1987
|
setUncertainId(plugin.id)
|
|
1881
|
-
|
|
1988
|
+
let restoreNotice = ''
|
|
1989
|
+
if (removedForUpdate) {
|
|
1990
|
+
const restoreState = await restorePreviousVersion()
|
|
1991
|
+
restoreNotice = restoreState === 'restored'
|
|
1992
|
+
? ` DSH 已恢复旧版本号 ${local.version}。${previousSourceIsRegistry ? '恢复按团队目录使用 npm 官方源;若此前来自私有源,请核对来源。' : ''}`
|
|
1993
|
+
: restoreState === 'target' ? ` 本机列表显示审核版本 ${plugin.version} 已安装,但操作结果未确认。`
|
|
1994
|
+
: ' DSH 未能确认旧版本恢复,请先在插件列表核对。'
|
|
1995
|
+
}
|
|
1996
|
+
const details = [installFailure && `installBundle:${safeInstallDiagnostic(installFailure)}`,
|
|
1997
|
+
waitFailure && `waitForInstall:${safeInstallDiagnostic(waitFailure)}`].filter(Boolean)
|
|
1998
|
+
setMessage(`暂时无法确认 ${plugin.title} 的安装结果(请求编号 ${requestReference})。${details.length
|
|
1999
|
+
? `本机诊断:${details.join(';')}。` : ''}${restoreNotice}请先在 DSH 插件列表核对,勿重复点击安装。`)
|
|
1882
2000
|
return
|
|
1883
2001
|
}
|
|
1884
2002
|
result = recovered
|
|
@@ -1894,9 +2012,22 @@ window.__ModuleLoader__.load({
|
|
|
1894
2012
|
setMessage(`DSH 无法确定 ${plugin.title} 本次安装的唯一结果,未确认完成。请先在 DSH 插件列表核对;若已经正常使用同版则无需重复安装,仍需核对来源时请联系管理员。`)
|
|
1895
2013
|
return
|
|
1896
2014
|
}
|
|
1897
|
-
const diagnostic =
|
|
1898
|
-
|
|
1899
|
-
|
|
2015
|
+
const diagnostic = safeInstallDiagnostic({ name: outcome.error?.name,
|
|
2016
|
+
code: outcome.error?.code,
|
|
2017
|
+
message: outcome.error?.diagnostic || outcome.error?.message || outcome.packageResult?.output })
|
|
2018
|
+
let restoreNotice = ''
|
|
2019
|
+
if (updateRestore) {
|
|
2020
|
+
restoreNotice = ['applied', 'restart-required'].includes(updateRestore.application)
|
|
2021
|
+
? ` DSH 已恢复旧版本 ${local.version}。` : ' DSH 未能确认旧版本已恢复,请先在插件列表核对。'
|
|
2022
|
+
} else if (removedForUpdate) {
|
|
2023
|
+
const restoreState = await restorePreviousVersion()
|
|
2024
|
+
restoreNotice = restoreState === 'restored'
|
|
2025
|
+
? ` DSH 已恢复旧版本号 ${local.version}。${previousSourceIsRegistry ? '恢复按团队目录使用 npm 官方源;若此前来自私有源,请核对来源。' : ''}`
|
|
2026
|
+
: restoreState === 'target' ? ` 本机列表显示审核版本 ${plugin.version} 已安装,但结果未确认。`
|
|
2027
|
+
: ' DSH 未能确认旧版本恢复,请先在插件列表核对。'
|
|
2028
|
+
}
|
|
2029
|
+
setMessage(`${plugin.title} 安装未完成(请求编号 ${requestReference})。${diagnostic
|
|
2030
|
+
? `DSH 诊断:${diagnostic}。` : 'DSH 没有返回失败诊断。'}${restoreNotice}请在 DSH 插件管理查看状态或联系管理员。`)
|
|
1900
2031
|
return
|
|
1901
2032
|
}
|
|
1902
2033
|
if (outcome.bundle !== plugin.package_name
|
|
@@ -2319,17 +2450,15 @@ window.__ModuleLoader__.load({
|
|
|
2319
2450
|
legacy: true,
|
|
2320
2451
|
}] : []
|
|
2321
2452
|
const allGroups = [...providerGroups, ...compatibilityGroup]
|
|
2453
|
+
let savedExcludedGroups = null
|
|
2454
|
+
try {
|
|
2455
|
+
const saved = JSON.parse(localStorage.getItem(providerSyncPreferenceKey(normalized)) || 'null')
|
|
2456
|
+
if (Array.isArray(saved)) savedExcludedGroups = saved
|
|
2457
|
+
} catch {}
|
|
2322
2458
|
let excludedGroups = options.excludedGroups
|
|
2459
|
+
if (!Array.isArray(excludedGroups) && savedExcludedGroups) excludedGroups = savedExcludedGroups
|
|
2323
2460
|
if (!Array.isArray(excludedGroups)) {
|
|
2324
|
-
|
|
2325
|
-
const saved = JSON.parse(localStorage.getItem(providerSyncPreferenceKey(normalized)) || 'null')
|
|
2326
|
-
if (Array.isArray(saved)) excludedGroups = saved
|
|
2327
|
-
} catch {}
|
|
2328
|
-
}
|
|
2329
|
-
if (!Array.isArray(excludedGroups)) {
|
|
2330
|
-
// Existing installs keep their current legacy alias group; first-time installs get all routes.
|
|
2331
|
-
excludedGroups = previousRoutes.length && compatibilityRoutes.length
|
|
2332
|
-
&& !compatibilityRoutes.some((route) => previousRoutes.includes(route)) ? ['legacy-openai-chat'] : []
|
|
2461
|
+
excludedGroups = []
|
|
2333
2462
|
}
|
|
2334
2463
|
excludedGroups = [...new Set(excludedGroups.filter((key) => allGroups.some((group) => group.key === key)))]
|
|
2335
2464
|
const excludedGroupSet = new Set(excludedGroups)
|
|
@@ -2346,8 +2475,13 @@ window.__ModuleLoader__.load({
|
|
|
2346
2475
|
const initialDefault = syncedDefaultMatch || (rawDefaultModel == null ? syncedModels[0] : null)
|
|
2347
2476
|
if (Array.isArray(options.excludedGroups)) {
|
|
2348
2477
|
const intentionallyRemovedRoutes = [...excluded].filter((route) => previousRoutes.includes(route))
|
|
2349
|
-
|
|
2350
|
-
|
|
2478
|
+
const disablingLegacyCompatibility = excludedGroupSet.has('legacy-openai-chat')
|
|
2479
|
+
&& !savedExcludedGroups?.includes('legacy-openai-chat')
|
|
2480
|
+
const needsConfirmation = intentionallyRemovedRoutes.length > 0 || disablingLegacyCompatibility
|
|
2481
|
+
const confirmationMessage = disablingLegacyCompatibility
|
|
2482
|
+
? '关闭旧会话兼容会从本机 DSH 移除兼容路由,可能影响历史会话。重新勾选并刷新可恢复。仍要应用吗?'
|
|
2483
|
+
: '关闭这些 provider 会从本机 DSH 移除对应模型路由,可能影响历史会话。重新勾选并刷新可恢复。仍要应用吗?'
|
|
2484
|
+
if (needsConfirmation && !window.confirm(confirmationMessage)) {
|
|
2351
2485
|
throw new Error('已取消同步范围更改;本机 DSH 设置未修改。')
|
|
2352
2486
|
}
|
|
2353
2487
|
const currentSelection = await readDshDefaultSelection()
|
|
@@ -2898,6 +3032,28 @@ window.__ModuleLoader__.load({
|
|
|
2898
3032
|
? isSynced ? '刷新后同步到 DSH' : '刷新后从 DSH 移除'
|
|
2899
3033
|
: isSynced ? '已同步到 DSH' : '未同步到 DSH'))
|
|
2900
3034
|
})
|
|
3035
|
+
const legacyCompatibilityGroup = providerSyncGroups.find((group) => group.legacy)
|
|
3036
|
+
const legacyCompatibilityModels = legacyCompatibilityGroup
|
|
3037
|
+
? authorizedModels.filter((model) => model.protocol === 'openai'
|
|
3038
|
+
&& (model.provider_id || 'openai-default') === 'openai-default') : []
|
|
3039
|
+
const legacyCompatibilityExcluded = legacyCompatibilityGroup
|
|
3040
|
+
? excludedGroupSet.has(legacyCompatibilityGroup.key) : true
|
|
3041
|
+
const legacyCompatibilityAppliedExcluded = legacyCompatibilityGroup
|
|
3042
|
+
? appliedExcludedGroupSet.has(legacyCompatibilityGroup.key) : true
|
|
3043
|
+
const legacyCompatibilityStatus = legacyCompatibilityExcluded === legacyCompatibilityAppliedExcluded
|
|
3044
|
+
? legacyCompatibilityExcluded ? '未同步到 DSH' : '已同步到 DSH'
|
|
3045
|
+
: legacyCompatibilityExcluded ? '刷新后从 DSH 移除' : '刷新后同步到 DSH'
|
|
3046
|
+
const legacyCompatibilityRows = legacyCompatibilityModels.map((model) => h('div', {
|
|
3047
|
+
key: `legacy-openai-chat:${model.provider_id || ''}:${model.model_id}`, role: 'listitem',
|
|
3048
|
+
style: { display: 'grid', gridTemplateColumns: 'minmax(0, 1fr) minmax(120px, auto) minmax(130px, auto)',
|
|
3049
|
+
gap: 12, alignItems: 'center', padding: '10px 2px', borderBottom: '1px solid var(--dsw-alias-border-l2)' },
|
|
3050
|
+
},
|
|
3051
|
+
h('strong', { style: { minWidth: 0, overflowWrap: 'anywhere' } },
|
|
3052
|
+
`${model.display_name || model.model_id}(旧会话兼容)`),
|
|
3053
|
+
h('span', { style: { display: 'inline-flex', justifySelf: 'start', padding: '3px 8px', borderRadius: 999,
|
|
3054
|
+
backgroundColor: 'var(--dsw-alias-bg-layer-2)', color: 'var(--dsw-alias-label-secondary)', fontSize: 12 } },
|
|
3055
|
+
'OpenAI · Chat(旧会话兼容)'),
|
|
3056
|
+
h('span', { style: { ...mutedTextStyle, textAlign: 'right' } }, legacyCompatibilityStatus)))
|
|
2901
3057
|
const connectionPanel = h('section', { style: { ...settingsPanelStyle, display: activeTab === 'connection' ? 'grid' : 'none' } },
|
|
2902
3058
|
h('div', null,
|
|
2903
3059
|
h('h3', { style: sectionTitleStyle }, 'ANT 团队账号'),
|
|
@@ -2994,16 +3150,20 @@ window.__ModuleLoader__.load({
|
|
|
2994
3150
|
defaultModelMessage ? h('p', { role: 'status', style: mutedTextStyle }, defaultModelMessage) : null),
|
|
2995
3151
|
providerSyncGroups.length ? h('section', { style: { ...infoNoticeStyle, gap: 8 } },
|
|
2996
3152
|
h('strong', null, '同步到本机 DSH 的 provider'),
|
|
2997
|
-
h('p', { style: mutedTextStyle }, '
|
|
3153
|
+
h('p', { style: mutedTextStyle }, '旧会话兼容路由默认开启。取消勾选并刷新后,该 provider 会从本机 DSH 移除;使用它的历史会话可能暂时无法继续,重新勾选并刷新可恢复。'),
|
|
2998
3154
|
h('p', { style: mutedTextStyle }, '至少保留一个常规模型 provider;旧会话兼容组只供已有会话使用。'),
|
|
2999
3155
|
hasPendingSyncChanges ? h('p', { role: 'status', style: mutedTextStyle }, '同步范围尚未应用;点击“刷新团队模型”后生效。') : null,
|
|
3000
|
-
...providerSyncGroups.map((group) =>
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3156
|
+
...providerSyncGroups.map((group) => {
|
|
3157
|
+
const label = group.legacy
|
|
3158
|
+
? group.label.replace('(旧会话兼容)', '(旧会话兼容,可选)') : group.label
|
|
3159
|
+
return h('label', { key: group.key,
|
|
3160
|
+
style: { display: 'flex', alignItems: 'center', gap: 9, padding: '5px 0', cursor: busy ? 'default' : 'pointer' } },
|
|
3161
|
+
h('input', { type: 'checkbox', 'aria-label': label,
|
|
3162
|
+
checked: !excludedGroupSet.has(group.key), disabled: busy
|
|
3163
|
+
|| (!group.legacy && !excludedGroupSet.has(group.key) && activePrimaryGroupCount <= 1),
|
|
3164
|
+
onChange: (event) => toggleProviderSyncGroup(group, event.target.checked) }),
|
|
3165
|
+
h('span', null, `${label} · ${group.modelCount} 个模型`))
|
|
3166
|
+
})) : null,
|
|
3007
3167
|
h('div', { role: 'list', 'aria-label': '获准模型', style: { display: 'grid', gap: 0, borderTop: '1px solid var(--dsw-alias-border-l2)' } },
|
|
3008
3168
|
modelRows.length ? modelRows : h('div', { style: { display: 'grid', gap: 8, padding: '12px 0' } },
|
|
3009
3169
|
h('p', { style: mutedTextStyle }, credentialConfigured === true && modelMessage.startsWith('正在') ? modelMessage
|
|
@@ -3011,6 +3171,11 @@ window.__ModuleLoader__.load({
|
|
|
3011
3171
|
: '连接并验证工作邮箱后,这里会列出逐个获准模型。'),
|
|
3012
3172
|
credentialConfigured !== true ? h('button', { type: 'button', onClick: () => onSelectTab('connection'),
|
|
3013
3173
|
style: secondaryButtonStyle }, '前往团队连接') : null)),
|
|
3174
|
+
legacyCompatibilityGroup ? h('section', { style: { ...infoNoticeStyle, gap: 6, marginTop: 14 } },
|
|
3175
|
+
h('strong', null, `旧会话兼容路由 · ${legacyCompatibilityModels.length} 个模型`),
|
|
3176
|
+
h('p', { style: mutedTextStyle }, '复用已获准的 OpenAI 模型,仅供已有会话使用,不增加获准模型数量。'),
|
|
3177
|
+
h('div', { role: 'list', 'aria-label': '旧会话兼容模型',
|
|
3178
|
+
style: { display: 'grid', gap: 0, borderTop: '1px solid var(--dsw-alias-border-l2)' } }, legacyCompatibilityRows)) : null,
|
|
3014
3179
|
h('div', { style: { display: 'flex', flexWrap: 'wrap', alignItems: 'center', gap: 10 } },
|
|
3015
3180
|
h('button', { type: 'button', disabled: busy || defaultModelBusy || !bindingReady || credentialConfigured !== true,
|
|
3016
3181
|
onClick: () => void refreshModels(true), style: primaryButtonStyle }, busy ? '刷新中…' : '刷新团队模型'),
|
package/conversation.js
CHANGED
|
@@ -224,7 +224,9 @@ function dshDefaultSelection(ctx) {
|
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
export async function modelFor(ctx, memberJson, connection) {
|
|
227
|
-
const catalog = await memberJson(connection, '/api/me/models'
|
|
227
|
+
const catalog = await memberJson(connection, '/api/me/models', {
|
|
228
|
+
headers: { 'x-ant-model-provider-config': '1' },
|
|
229
|
+
})
|
|
228
230
|
const models = catalog.models?.filter((item) => ['openai', 'anthropic'].includes(item.protocol)) || []
|
|
229
231
|
const selection = dshDefaultSelection(ctx)
|
|
230
232
|
const localDefault = selection && models.find((item) => item.model_id === selection.model
|
package/delegation.js
CHANGED
|
@@ -1035,7 +1035,7 @@ function parseGroupPrRequest(text) {
|
|
|
1035
1035
|
export async function memberJson(connection, path, init = {}) {
|
|
1036
1036
|
const response = await fetch(new URL(path, connection.serviceUrl), {
|
|
1037
1037
|
...init,
|
|
1038
|
-
headers: { authorization: `Bearer ${connection.token}`, accept: 'application/json',
|
|
1038
|
+
headers: { ...(init.headers || {}), authorization: `Bearer ${connection.token}`, accept: 'application/json',
|
|
1039
1039
|
...(init.body ? { origin: new URL(connection.serviceUrl).origin, 'content-type': 'application/json' } : {}) },
|
|
1040
1040
|
redirect: 'manual', signal: init.signal
|
|
1041
1041
|
? AbortSignal.any([init.signal, AbortSignal.timeout(12_000)]) : AbortSignal.timeout(12_000),
|
package/index.js
CHANGED
|
@@ -1104,7 +1104,7 @@ export function apply(ctx) {
|
|
|
1104
1104
|
} catch {}
|
|
1105
1105
|
}
|
|
1106
1106
|
}, 'ant-teams: ANT model activity session')
|
|
1107
|
-
connectionCtx.inject?.(['dshIm', 'sessionController', 'sessions', 'agents', 'tools'], (delegationCtx) => {
|
|
1107
|
+
connectionCtx.inject?.(['dshIm', 'sessionController', 'sessions', 'agents', 'tools', 'agentDefaultModel'], (delegationCtx) => {
|
|
1108
1108
|
delegationCtx.effect(() => {
|
|
1109
1109
|
const host = startDelegationHost(delegationCtx,
|
|
1110
1110
|
() => readMemberConnection(delegationCtx.credentials, delegationCtx.settings))
|