@nextclaw/ui 0.3.8 → 0.3.10

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.
@@ -100,85 +100,87 @@ export function ProviderForm() {
100
100
  </div>
101
101
  </DialogHeader>
102
102
 
103
- <form onSubmit={handleSubmit} className="space-y-5 pt-2">
104
- <div className="space-y-2.5">
105
- <Label htmlFor="apiKey" className="text-sm font-medium text-gray-900 flex items-center gap-2">
106
- <KeyRound className="h-3.5 w-3.5 text-gray-500" />
107
- {apiKeyHint?.label ?? t('apiKey')}
108
- </Label>
109
- <MaskedInput
110
- id="apiKey"
111
- value={apiKey}
112
- isSet={providerConfig?.apiKeySet}
113
- onChange={(e) => setApiKey(e.target.value)}
114
- placeholder={
115
- providerConfig?.apiKeySet
116
- ? t('apiKeySet')
117
- : apiKeyHint?.placeholder ?? 'Enter API Key'
118
- }
119
- className="rounded-xl"
120
- />
121
- </div>
103
+ <form onSubmit={handleSubmit} className="flex flex-col pt-2">
104
+ <div className="space-y-5 max-h-[60vh] overflow-y-auto pr-1">
105
+ <div className="space-y-2.5">
106
+ <Label htmlFor="apiKey" className="text-sm font-medium text-gray-900 flex items-center gap-2">
107
+ <KeyRound className="h-3.5 w-3.5 text-gray-500" />
108
+ {apiKeyHint?.label ?? t('apiKey')}
109
+ </Label>
110
+ <MaskedInput
111
+ id="apiKey"
112
+ value={apiKey}
113
+ isSet={providerConfig?.apiKeySet}
114
+ onChange={(e) => setApiKey(e.target.value)}
115
+ placeholder={
116
+ providerConfig?.apiKeySet
117
+ ? t('apiKeySet')
118
+ : apiKeyHint?.placeholder ?? 'Enter API Key'
119
+ }
120
+ className="rounded-xl"
121
+ />
122
+ </div>
122
123
 
123
- <div className="space-y-2.5">
124
- <Label htmlFor="apiBase" className="text-sm font-medium text-gray-900 flex items-center gap-2">
125
- <Globe className="h-3.5 w-3.5 text-gray-500" />
126
- {apiBaseHint?.label ?? t('apiBase')}
127
- </Label>
128
- <Input
129
- id="apiBase"
130
- type="text"
131
- value={apiBase}
132
- onChange={(e) => setApiBase(e.target.value)}
133
- placeholder={
134
- providerSpec?.defaultApiBase ||
135
- apiBaseHint?.placeholder ||
136
- 'https://api.example.com'
137
- }
138
- className="rounded-xl"
139
- />
140
- {apiBaseHint?.help && (
141
- <p className="text-xs text-gray-500">{apiBaseHint.help}</p>
124
+ <div className="space-y-2.5">
125
+ <Label htmlFor="apiBase" className="text-sm font-medium text-gray-900 flex items-center gap-2">
126
+ <Globe className="h-3.5 w-3.5 text-gray-500" />
127
+ {apiBaseHint?.label ?? t('apiBase')}
128
+ </Label>
129
+ <Input
130
+ id="apiBase"
131
+ type="text"
132
+ value={apiBase}
133
+ onChange={(e) => setApiBase(e.target.value)}
134
+ placeholder={
135
+ providerSpec?.defaultApiBase ||
136
+ apiBaseHint?.placeholder ||
137
+ 'https://api.example.com'
138
+ }
139
+ className="rounded-xl"
140
+ />
141
+ {apiBaseHint?.help && (
142
+ <p className="text-xs text-gray-500">{apiBaseHint.help}</p>
143
+ )}
144
+ </div>
145
+
146
+ {providerSpec?.supportsWireApi && (
147
+ <div className="space-y-2.5">
148
+ <Label htmlFor="wireApi" className="text-sm font-medium text-gray-900 flex items-center gap-2">
149
+ <Hash className="h-3.5 w-3.5 text-gray-500" />
150
+ {wireApiHint?.label ?? t('wireApi')}
151
+ </Label>
152
+ <select
153
+ id="wireApi"
154
+ value={wireApi}
155
+ onChange={(e) => setWireApi(e.target.value as 'auto' | 'chat' | 'responses')}
156
+ 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"
157
+ >
158
+ {(providerSpec.wireApiOptions || ['auto', 'chat', 'responses']).map((option) => (
159
+ <option key={option} value={option}>
160
+ {option === 'chat'
161
+ ? t('wireApiChat')
162
+ : option === 'responses'
163
+ ? t('wireApiResponses')
164
+ : t('wireApiAuto')}
165
+ </option>
166
+ ))}
167
+ </select>
168
+ </div>
142
169
  )}
143
- </div>
144
170
 
145
- {providerSpec?.supportsWireApi && (
146
171
  <div className="space-y-2.5">
147
- <Label htmlFor="wireApi" className="text-sm font-medium text-gray-900 flex items-center gap-2">
148
- <Hash className="h-3.5 w-3.5 text-gray-500" />
149
- {wireApiHint?.label ?? t('wireApi')}
150
- </Label>
151
- <select
152
- id="wireApi"
153
- value={wireApi}
154
- onChange={(e) => setWireApi(e.target.value as 'auto' | 'chat' | 'responses')}
155
- 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"
156
- >
157
- {(providerSpec.wireApiOptions || ['auto', 'chat', 'responses']).map((option) => (
158
- <option key={option} value={option}>
159
- {option === 'chat'
160
- ? t('wireApiChat')
161
- : option === 'responses'
162
- ? t('wireApiResponses')
163
- : t('wireApiAuto')}
164
- </option>
165
- ))}
166
- </select>
172
+ <Label className="text-sm font-medium text-gray-900 flex items-center gap-2">
173
+ <Hash className="h-3.5 w-3.5 text-gray-500" />
174
+ {extraHeadersHint?.label ?? t('extraHeaders')}
175
+ </Label>
176
+ <KeyValueEditor
177
+ value={extraHeaders}
178
+ onChange={setExtraHeaders}
179
+ />
167
180
  </div>
168
- )}
169
-
170
- <div className="space-y-2.5">
171
- <Label className="text-sm font-medium text-gray-900 flex items-center gap-2">
172
- <Hash className="h-3.5 w-3.5 text-gray-500" />
173
- {extraHeadersHint?.label ?? t('extraHeaders')}
174
- </Label>
175
- <KeyValueEditor
176
- value={extraHeaders}
177
- onChange={setExtraHeaders}
178
- />
179
181
  </div>
180
182
 
181
- <DialogFooter className="pt-4">
183
+ <DialogFooter className="pt-4 flex-shrink-0">
182
184
  <Button
183
185
  type="button"
184
186
  variant="outline"
@@ -5,7 +5,8 @@ import {
5
5
  fetchConfigSchema,
6
6
  updateModel,
7
7
  updateProvider,
8
- updateChannel
8
+ updateChannel,
9
+ executeConfigAction
9
10
  } from '@/api/config';
10
11
  import { toast } from 'sonner';
11
12
  import { t } from '@/lib/i18n';
@@ -81,3 +82,13 @@ export function useUpdateChannel() {
81
82
  }
82
83
  });
83
84
  }
85
+
86
+ export function useExecuteConfigAction() {
87
+ return useMutation({
88
+ mutationFn: ({ actionId, data }: { actionId: string; data: unknown }) =>
89
+ executeConfigAction(actionId, data as Parameters<typeof executeConfigAction>[1]),
90
+ onError: (error: Error) => {
91
+ toast.error(t('error') + ': ' + error.message);
92
+ }
93
+ });
94
+ }
package/src/lib/i18n.ts CHANGED
@@ -21,7 +21,6 @@ export const LABELS: Record<string, { zh: string; en: string }> = {
21
21
  modelName: { zh: '模型', en: 'Model' },
22
22
  workspace: { zh: '工作空间', en: 'Workspace' },
23
23
  maxTokens: { zh: '最大 Token 数', en: 'Max Tokens' },
24
- temperature: { zh: '温度', en: 'Temperature' },
25
24
  maxToolIterations: { zh: '最大工具迭代次数', en: 'Max Tool Iterations' },
26
25
 
27
26
  // Provider