| 289 | } |
| 290 | |
| 291 | const handleCopyConfig = (config: LLMConfig) => { |
| 292 | const currentConfigs = settings.llmConfigs || [] |
| 293 | const hasDefaultConfig = settings.defaultLLMId |
| 294 | |
| 295 | const newConfig: LLMConfig = { |
| 296 | ...config, |
| 297 | id: uuidv4(), |
| 298 | name: `${config.name} (副本)`, |
| 299 | createdAt: Date.now() |
| 300 | } |
| 301 | |
| 302 | addLLMConfig(newConfig) |
| 303 | |
| 304 | // 如果没有默认配置,则将新配置设为默认 |
| 305 | if (!hasDefaultConfig) { |
| 306 | setDefaultLLM(newConfig.id) |
| 307 | } |
| 308 | |
| 309 | message.success('配置已复制') |
| 310 | } |
| 311 | |
| 312 | const handleSetDefault = (id: string) => { |
| 313 | setDefaultLLM(id) |