@nextclaw/ui 0.2.5 → 0.3.0

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/dist/index.html CHANGED
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/logo.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>nextclaw - 系统配置</title>
8
- <script type="module" crossorigin src="/assets/index-BV3Gyu8h.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-BIesvTqn.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-iSLahgqA.css">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextclaw/ui",
3
- "version": "0.2.5",
3
+ "version": "0.3.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/api/types.ts CHANGED
@@ -14,12 +14,14 @@ export type ProviderConfigView = {
14
14
  apiKeyMasked?: string;
15
15
  apiBase?: string | null;
16
16
  extraHeaders?: Record<string, string> | null;
17
+ wireApi?: "auto" | "chat" | "responses" | null;
17
18
  };
18
19
 
19
20
  export type ProviderConfigUpdate = {
20
21
  apiKey?: string | null;
21
22
  apiBase?: string | null;
22
23
  extraHeaders?: Record<string, string> | null;
24
+ wireApi?: "auto" | "chat" | "responses" | null;
23
25
  };
24
26
 
25
27
  export type ChannelConfigUpdate = Record<string, unknown>;
@@ -48,6 +50,9 @@ export type ProviderSpecView = {
48
50
  isGateway?: boolean;
49
51
  isLocal?: boolean;
50
52
  defaultApiBase?: string;
53
+ supportsWireApi?: boolean;
54
+ wireApiOptions?: Array<"auto" | "chat" | "responses">;
55
+ defaultWireApi?: "auto" | "chat" | "responses";
51
56
  };
52
57
 
53
58
  export type ChannelSpecView = {
@@ -27,6 +27,7 @@ export function ProviderForm() {
27
27
  const [apiKey, setApiKey] = useState('');
28
28
  const [apiBase, setApiBase] = useState('');
29
29
  const [extraHeaders, setExtraHeaders] = useState<Record<string, string> | null>(null);
30
+ const [wireApi, setWireApi] = useState<'auto' | 'chat' | 'responses'>('auto');
30
31
 
31
32
  const providerName = providerModal.provider;
32
33
  const providerSpec = meta?.providers.find((p) => p.name === providerName);
@@ -37,6 +38,9 @@ export function ProviderForm() {
37
38
  setApiBase(providerConfig.apiBase || providerSpec?.defaultApiBase || '');
38
39
  setExtraHeaders(providerConfig.extraHeaders || null);
39
40
  setApiKey(''); // Always start with empty for security
41
+ const nextWireApi =
42
+ providerConfig.wireApi || providerSpec?.defaultWireApi || 'auto';
43
+ setWireApi(nextWireApi as 'auto' | 'chat' | 'responses');
40
44
  }
41
45
  }, [providerConfig, providerSpec]);
42
46
 
@@ -58,6 +62,14 @@ export function ProviderForm() {
58
62
  payload.extraHeaders = extraHeaders;
59
63
  }
60
64
 
65
+ if (providerSpec?.supportsWireApi) {
66
+ const currentWireApi =
67
+ providerConfig?.wireApi || providerSpec.defaultWireApi || 'auto';
68
+ if (wireApi !== currentWireApi) {
69
+ payload.wireApi = wireApi;
70
+ }
71
+ }
72
+
61
73
  if (!providerName) return;
62
74
 
63
75
  updateProvider.mutate(
@@ -112,6 +124,31 @@ export function ProviderForm() {
112
124
  />
113
125
  </div>
114
126
 
127
+ {providerSpec?.supportsWireApi && (
128
+ <div className="space-y-2.5">
129
+ <Label htmlFor="wireApi" className="text-sm font-medium text-gray-900 flex items-center gap-2">
130
+ <Hash className="h-3.5 w-3.5 text-gray-500" />
131
+ {t('wireApi')}
132
+ </Label>
133
+ <select
134
+ id="wireApi"
135
+ value={wireApi}
136
+ onChange={(e) => setWireApi(e.target.value as 'auto' | 'chat' | 'responses')}
137
+ className="flex h-10 w-full rounded-lg border border-gray-200 bg-white px-3 py-2 text-sm focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
138
+ >
139
+ {(providerSpec.wireApiOptions || ['auto', 'chat', 'responses']).map((option) => (
140
+ <option key={option} value={option}>
141
+ {option === 'chat'
142
+ ? t('wireApiChat')
143
+ : option === 'responses'
144
+ ? t('wireApiResponses')
145
+ : t('wireApiAuto')}
146
+ </option>
147
+ ))}
148
+ </select>
149
+ </div>
150
+ )}
151
+
115
152
  <div className="space-y-2.5">
116
153
  <Label className="text-sm font-medium text-gray-900 flex items-center gap-2">
117
154
  <Hash className="h-3.5 w-3.5 text-gray-500" />
package/src/lib/i18n.ts CHANGED
@@ -28,6 +28,10 @@ export const LABELS: Record<string, { zh: string; en: string }> = {
28
28
  apiKey: { zh: 'API 密钥', en: 'API Key' },
29
29
  apiBase: { zh: 'API Base', en: 'API Base' },
30
30
  extraHeaders: { zh: '额外请求头', en: 'Extra Headers' },
31
+ wireApi: { zh: '请求接口', en: 'Wire API' },
32
+ wireApiAuto: { zh: '自动(优先 Chat,必要时 Responses)', en: 'Auto (Chat with fallback)' },
33
+ wireApiChat: { zh: 'Chat Completions', en: 'Chat Completions' },
34
+ wireApiResponses: { zh: 'Responses', en: 'Responses' },
31
35
  apiKeySet: { zh: '已设置', en: 'Set' },
32
36
  apiKeyNotSet: { zh: '未设置', en: 'Not Set' },
33
37
  showKey: { zh: '显示密钥', en: 'Show Key' },