@@ -3,6 +3,14 @@ import { imageServiceOptions } from '@md/shared/configs'
3
3
import { DEFAULT_SERVICE_TYPE } from ' @md/shared/constants'
4
4
import { Info } from ' lucide-vue-next'
5
5
import { Button } from ' @/components/ui/button'
6
+ import { Label } from ' @/components/ui/label'
7
+ import {
8
+ Select ,
9
+ SelectContent ,
10
+ SelectItem ,
11
+ SelectTrigger ,
12
+ SelectValue ,
13
+ } from ' @/components/ui/select'
6
14
import useAIImageConfigStore from ' @/stores/AIImageConfig'
7
15
8
16
/* -------------------------- 基础数据 -------------------------- */
@@ -183,25 +191,28 @@ const styleOptions = [
183
191
184
192
<!-- 服务商选择 -->
185
193
<div >
186
- <label class =" text-sm font-medium" >服务商</label >
187
- <select
188
- v-model =" config.type"
189
- class =" w-full mt-1 p-2 border rounded-md bg-background focus:ring-2 focus:ring-primary focus:border-primary transition-colors"
190
- @change =" handleServiceChange"
191
- >
192
- <option
193
- v-for =" option in imageServiceOptions"
194
- :key =" option.value"
195
- :value =" option.value"
196
- >
197
- {{ option.label }}
198
- </option >
199
- </select >
194
+ <Label class =" mb-1 block text-sm font-medium" >服务商</Label >
195
+ <Select v-model =" config.type" @update:model-value =" handleServiceChange" >
196
+ <SelectTrigger class =" w-full" >
197
+ <SelectValue >
198
+ {{ currentService.label }}
199
+ </SelectValue >
200
+ </SelectTrigger >
201
+ <SelectContent >
202
+ <SelectItem
203
+ v-for =" option in imageServiceOptions"
204
+ :key =" option.value"
205
+ :value =" option.value"
206
+ >
207
+ {{ option.label }}
208
+ </SelectItem >
209
+ </SelectContent >
210
+ </Select >
200
211
</div >
201
212
202
213
<!-- 端点配置 -->
203
214
<div >
204
- <label class =" text-sm font-medium" >API 端点</label >
215
+ <Label class =" mb-1 block text-sm font-medium" >API 端点</Label >
205
216
<input
206
217
v-model =" config.endpoint"
207
218
type =" url"
@@ -213,7 +224,7 @@ const styleOptions = [
213
224
214
225
<!-- API Key -->
215
226
<div v-if =" config.type !== 'default'" >
216
- <label class =" text-sm font-medium" >API Key</label >
227
+ <Label class =" mb-1 block text-sm font-medium" >API Key</Label >
217
228
<input
218
229
v-model =" config.apiKey"
219
230
type =" password"
@@ -224,70 +235,86 @@ const styleOptions = [
224
235
225
236
<!-- 模型选择 -->
226
237
<div >
227
- <label class =" text-sm font-medium" >模型</label >
228
- <select
229
- v-model =" config.model"
230
- class =" w-full mt-1 p-2 border rounded-md bg-background focus:ring-2 focus:ring-primary focus:border-primary transition-colors"
231
- >
232
- <option
233
- v-for =" modelName in currentService.models"
234
- :key =" modelName"
235
- :value =" modelName"
236
- >
237
- {{ modelName }}
238
- </option >
239
- </select >
238
+ <Label class =" mb-1 block text-sm font-medium" >模型</Label >
239
+ <Select v-model =" config.model" >
240
+ <SelectTrigger class =" w-full" >
241
+ <SelectValue >
242
+ {{ config.model || '请选择模型' }}
243
+ </SelectValue >
244
+ </SelectTrigger >
245
+ <SelectContent >
246
+ <SelectItem
247
+ v-for =" modelName in currentService.models"
248
+ :key =" modelName"
249
+ :value =" modelName"
250
+ >
251
+ {{ modelName }}
252
+ </SelectItem >
253
+ </SelectContent >
254
+ </Select >
240
255
</div >
241
256
242
257
<!-- 图像尺寸 -->
243
258
<div >
244
- <label class =" text-sm font-medium" >图像尺寸</label >
245
- <select
246
- v-model =" config.size"
247
- class =" w-full mt-1 p-2 border rounded-md bg-background focus:ring-2 focus:ring-primary focus:border-primary transition-colors"
248
- >
249
- <option
250
- v-for =" option in sizeOptions"
251
- :key =" option.value"
252
- :value =" option.value"
253
- >
254
- {{ option.label }}
255
- </option >
256
- </select >
259
+ <Label class =" mb-1 block text-sm font-medium" >图像尺寸</Label >
260
+ <Select v-model =" config.size" >
261
+ <SelectTrigger class =" w-full" >
262
+ <SelectValue >
263
+ {{ sizeOptions.find(opt => opt.value === config.size)?.label || config.size }}
264
+ </SelectValue >
265
+ </SelectTrigger >
266
+ <SelectContent >
267
+ <SelectItem
268
+ v-for =" option in sizeOptions"
269
+ :key =" option.value"
270
+ :value =" option.value"
271
+ >
272
+ {{ option.label }}
273
+ </SelectItem >
274
+ </SelectContent >
275
+ </Select >
257
276
</div >
258
277
259
278
<!-- 图像质量 -->
260
279
<div v-if =" config.model.includes('dall-e')" >
261
- <label class =" text-sm font-medium" >图像质量</label >
262
- <select
263
- v-model =" config.quality"
264
- class =" w-full mt-1 p-2 border rounded-md bg-background focus:ring-2 focus:ring-primary focus:border-primary transition-colors"
265
- >
266
- <option
267
- v-for =" option in qualityOptions"
268
- :key =" option.value"
269
- :value =" option.value"
270
- >
271
- {{ option.label }}
272
- </option >
273
- </select >
280
+ <Label class =" mb-1 block text-sm font-medium" >图像质量</Label >
281
+ <Select v-model =" config.quality" >
282
+ <SelectTrigger class =" w-full" >
283
+ <SelectValue >
284
+ {{ qualityOptions.find(opt => opt.value === config.quality)?.label || config.quality }}
285
+ </SelectValue >
286
+ </SelectTrigger >
287
+ <SelectContent >
288
+ <SelectItem
289
+ v-for =" option in qualityOptions"
290
+ :key =" option.value"
291
+ :value =" option.value"
292
+ >
293
+ {{ option.label }}
294
+ </SelectItem >
295
+ </SelectContent >
296
+ </Select >
274
297
</div >
275
298
276
299
<!-- 图像风格 -->
277
300
<div v-if =" config.model.includes('dall-e')" >
278
- <label class =" text-sm font-medium" >图像风格</label >
279
- <select
280
- v-model =" config.style"
281
- class =" w-full mt-1 p-2 border rounded-md bg-background focus:ring-2 focus:ring-primary focus:border-primary transition-colors"
282
- >
283
- <option
284
- v-for =" option in styleOptions"
285
- :key =" option.value"
286
- :value =" option.value"
287
- >
288
- {{ option.label }}
289
- </option >
290
- </select >
301
+ <Label class =" mb-1 block text-sm font-medium" >图像风格</Label >
302
+ <Select v-model =" config.style" >
303
+ <SelectTrigger class =" w-full" >
304
+ <SelectValue >
305
+ {{ styleOptions.find(opt => opt.value === config.style)?.label || config.style }}
306
+ </SelectValue >
307
+ </SelectTrigger >
308
+ <SelectContent >
309
+ <SelectItem
310
+ v-for =" option in styleOptions"
311
+ :key =" option.value"
312
+ :value =" option.value"
313
+ >
314
+ {{ option.label }}
315
+ </SelectItem >
316
+ </SelectContent >
317
+ </Select >
291
318
</div >
292
319
293
320
<!-- 说明 -->
0 commit comments