@ai-wendao/ant 0.4.12 → 0.4.13

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.
Files changed (2) hide show
  1. package/client.js +34 -14
  2. package/package.json +1 -1
package/client.js CHANGED
@@ -5,6 +5,12 @@ window.__ModuleLoader__.load({
5
5
  var exports = module.exports
6
6
  const { createElement, useEffect, useRef, useState } = require('react')
7
7
  const h = createElement
8
+ const compactOpenaiProviderName = (name) => {
9
+ const value = typeof name === 'string' ? name.trim() : ''
10
+ if (!value) return value
11
+ const suffix = /\s*(?:[·•::|—–-]\s*)?(?:Responses|Chat Completions)$/iu
12
+ return value.replace(suffix, '').trim() || 'OpenAI'
13
+ }
8
14
  const SERVICE_URL_STORAGE_KEY = 'ant-team-service-url'
9
15
  const PROVIDER_ROUTES_STORAGE_KEY = 'ant-team-provider-routes'
10
16
  const DEVICE_ID_STORAGE_KEY = 'ant-team-device-id'
@@ -2063,11 +2069,13 @@ window.__ModuleLoader__.load({
2063
2069
  const key = `${providerId}\u0000${protocol}`
2064
2070
  let provider = grouped.get(key)
2065
2071
  if (!provider) {
2072
+ const providerName = model.provider_name || (protocol === 'openai'
2073
+ ? 'ANT 团队 · OpenAI' : 'ANT 团队 · Anthropic')
2066
2074
  provider = {
2067
2075
  providerId,
2068
- providerName: model.provider_name || (protocol === 'openai'
2069
- ? `ANT 团队 · OpenAI · ${model.openai_api_mode === 'responses' ? 'Responses' : 'Chat Completions'}`
2070
- : 'ANT 团队 · Anthropic'),
2076
+ providerName: protocol === 'openai'
2077
+ ? compactOpenaiProviderName(providerName)
2078
+ : providerName,
2071
2079
  protocol,
2072
2080
  apiMode: model.openai_api_mode === 'responses' ? 'responses' : 'chat_completions',
2073
2081
  legacyEndpoint: typeof model.provider_id !== 'string' || !model.provider_id,
@@ -2605,14 +2613,19 @@ window.__ModuleLoader__.load({
2605
2613
  const updateGuideUrl = pinnedServiceUrl
2606
2614
  ? new URL('/ant-update', pinnedServiceUrl).href : null
2607
2615
  const currentDshDefaultModel = modelForProviderSelection(dshDefaultSelection, authorizedModels)
2608
- const modelRows = authorizedModels.map((model) => h('div', { key: `${model.provider_id || ''}:${model.protocol}:${model.model_id}`, role: 'listitem',
2609
- style: { display: 'grid', gridTemplateColumns: 'minmax(0, 1fr) minmax(120px, auto) minmax(130px, auto)',
2610
- gap: 12, alignItems: 'center', padding: '10px 2px', borderBottom: '1px solid var(--dsw-alias-border-l2)' } },
2611
- h('strong', { style: { minWidth: 0, overflowWrap: 'anywhere' } }, `${model.provider_name ? `${model.provider_name} · ` : ''}${model.display_name || model.model_id}`),
2612
- h('span', { style: { display: 'inline-flex', justifySelf: 'start', padding: '3px 8px', borderRadius: 999,
2613
- backgroundColor: 'var(--dsw-alias-bg-layer-2)', color: 'var(--dsw-alias-label-secondary)', fontSize: 12 } },
2614
- model.protocol === 'anthropic' ? 'Anthropic Messages' : `OpenAI · ${model.openai_api_mode === 'responses' ? 'Responses' : 'Chat Completions'}`),
2615
- h('span', { style: { ...mutedTextStyle, textAlign: 'right' } }, '已同步到 DSH')))
2616
+ const modelRows = authorizedModels.map((model) => {
2617
+ const providerName = model.protocol === 'openai'
2618
+ ? compactOpenaiProviderName(model.provider_name)
2619
+ : model.provider_name
2620
+ return h('div', { key: `${model.provider_id || ''}:${model.protocol}:${model.model_id}`, role: 'listitem',
2621
+ style: { display: 'grid', gridTemplateColumns: 'minmax(0, 1fr) minmax(120px, auto) minmax(130px, auto)',
2622
+ gap: 12, alignItems: 'center', padding: '10px 2px', borderBottom: '1px solid var(--dsw-alias-border-l2)' } },
2623
+ h('strong', { style: { minWidth: 0, overflowWrap: 'anywhere' } }, `${providerName ? `${providerName} · ` : ''}${model.display_name || model.model_id}`),
2624
+ h('span', { style: { display: 'inline-flex', justifySelf: 'start', padding: '3px 8px', borderRadius: 999,
2625
+ backgroundColor: 'var(--dsw-alias-bg-layer-2)', color: 'var(--dsw-alias-label-secondary)', fontSize: 12 } },
2626
+ model.protocol === 'anthropic' ? 'Anthropic Messages' : `OpenAI · ${model.openai_api_mode === 'responses' ? 'Responses' : 'Chat Completions'}`),
2627
+ h('span', { style: { ...mutedTextStyle, textAlign: 'right' } }, '已同步到 DSH'))
2628
+ })
2616
2629
  const connectionPanel = h('section', { style: { ...settingsPanelStyle, display: activeTab === 'connection' ? 'grid' : 'none' } },
2617
2630
  h('div', null,
2618
2631
  h('h3', { style: sectionTitleStyle }, 'ANT 团队账号'),
@@ -2669,7 +2682,8 @@ window.__ModuleLoader__.load({
2669
2682
  h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start', gap: 12 } },
2670
2683
  h('div', null,
2671
2684
  h('h3', { style: sectionTitleStyle }, '团队模型'),
2672
- h('p', { style: { ...mutedTextStyle, marginTop: 4 } }, '每个获准模型单独列出;刷新后同步到 DSH 模型选择器。')),
2685
+ h('p', { style: { ...mutedTextStyle, marginTop: 4 } }, '每个获准模型单独列出;刷新后同步到 DSH 模型选择器。'),
2686
+ h('p', { style: { ...mutedTextStyle, marginTop: 4 } }, 'API 模式由 ANT 团队提供方设置统一控制,作用于该提供方下的所有模型。DSH 设置中的模式只影响当前 Profile,不会修改服务器;模式不匹配会导致请求失败,刷新团队模型会重新应用团队设置。')),
2673
2687
  h('span', { style: { flexShrink: 0, padding: '4px 9px', borderRadius: 999,
2674
2688
  color: credentialConfigured === true && bindingReady ? 'var(--dsw-alias-state-success-primary)' : 'var(--dsw-alias-label-secondary)',
2675
2689
  backgroundColor: credentialConfigured === true && bindingReady ? 'var(--dsw-alias-state-success-tertiary)' : 'var(--dsw-alias-bg-layer-2)',
@@ -2687,8 +2701,14 @@ window.__ModuleLoader__.load({
2687
2701
  disabled: credentialConfigured !== true || !authorizedModels.length || defaultModelBusy || busy,
2688
2702
  onChange: (event) => setDefaultModelDraft(event.target.value), style: inputStyle },
2689
2703
  h('option', { value: '' }, '选择获准模型'),
2690
- ...authorizedModels.map((model) => h('option', { key: modelSelectionKey(model), value: modelSelectionKey(model) },
2691
- `${model.provider_name ? `${model.provider_name} · ` : ''}${model.display_name || model.model_id} · ${model.protocol === 'anthropic' ? 'Anthropic' : model.openai_api_mode === 'responses' ? 'OpenAI Responses' : 'OpenAI Chat Completions'}`)))),
2704
+ ...authorizedModels.map((model) => {
2705
+ const providerName = model.protocol === 'openai'
2706
+ ? compactOpenaiProviderName(model.provider_name)
2707
+ : model.provider_name
2708
+ const protocolName = model.protocol === 'anthropic' ? 'Anthropic' : `OpenAI ${model.openai_api_mode === 'responses' ? 'Responses' : 'Chat Completions'}`
2709
+ return h('option', { key: modelSelectionKey(model), value: modelSelectionKey(model) },
2710
+ `${providerName ? `${providerName} · ` : ''}${model.display_name || model.model_id} · ${protocolName}`)
2711
+ }))),
2692
2712
  h('div', { style: { display: 'flex', gap: 8, flexWrap: 'wrap', alignItems: 'center' } },
2693
2713
  h('button', { type: 'button', disabled: defaultModelBusy || !defaultModelDraft,
2694
2714
  onClick: () => { const chosen = authorizedModels.find((model) => modelSelectionKey(model) === defaultModelDraft); void applyUserDefaultModel(chosen) },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-wendao/ant",
3
- "version": "0.4.12",
3
+ "version": "0.4.13",
4
4
  "description": "ANT (AI-native Teams) connects a DeepSeek Harness Desktop profile to team identity and approved models.",
5
5
  "type": "module",
6
6
  "scripts": {