@lobehub/chat 1.53.7 → 1.53.9
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/CHANGELOG.md +50 -0
- package/changelog/v1.json +18 -0
- package/docs/self-hosting/advanced/model-list.mdx +9 -7
- package/docs/self-hosting/advanced/model-list.zh-CN.mdx +9 -7
- package/locales/ar/modelProvider.json +5 -0
- package/locales/bg-BG/modelProvider.json +5 -0
- package/locales/de-DE/modelProvider.json +5 -0
- package/locales/en-US/modelProvider.json +5 -0
- package/locales/es-ES/modelProvider.json +5 -0
- package/locales/fa-IR/modelProvider.json +5 -0
- package/locales/fr-FR/modelProvider.json +5 -0
- package/locales/it-IT/modelProvider.json +5 -0
- package/locales/ja-JP/modelProvider.json +5 -0
- package/locales/ko-KR/modelProvider.json +5 -0
- package/locales/nl-NL/modelProvider.json +5 -0
- package/locales/pl-PL/modelProvider.json +5 -0
- package/locales/pt-BR/modelProvider.json +5 -0
- package/locales/ru-RU/modelProvider.json +5 -0
- package/locales/tr-TR/modelProvider.json +5 -0
- package/locales/vi-VN/modelProvider.json +5 -0
- package/locales/zh-CN/auth.json +1 -1
- package/locales/zh-CN/changelog.json +1 -1
- package/locales/zh-CN/chat.json +1 -1
- package/locales/zh-CN/clerk.json +1 -1
- package/locales/zh-CN/common.json +1 -1
- package/locales/zh-CN/components.json +1 -1
- package/locales/zh-CN/discover.json +1 -1
- package/locales/zh-CN/error.json +1 -1
- package/locales/zh-CN/file.json +1 -1
- package/locales/zh-CN/knowledgeBase.json +1 -1
- package/locales/zh-CN/metadata.json +1 -1
- package/locales/zh-CN/migration.json +1 -1
- package/locales/zh-CN/modelProvider.json +6 -1
- package/locales/zh-CN/models.json +1049 -1049
- package/locales/zh-CN/plugin.json +1 -1
- package/locales/zh-CN/portal.json +1 -1
- package/locales/zh-CN/providers.json +70 -70
- package/locales/zh-CN/ragEval.json +1 -1
- package/locales/zh-CN/setting.json +1 -1
- package/locales/zh-CN/thread.json +1 -1
- package/locales/zh-CN/tool.json +1 -1
- package/locales/zh-CN/topic.json +1 -1
- package/locales/zh-CN/welcome.json +1 -1
- package/locales/zh-TW/modelProvider.json +5 -0
- package/package.json +1 -1
- package/src/app/[variants]/(main)/settings/provider/(detail)/azure/page.tsx +4 -8
- package/src/app/[variants]/(main)/settings/provider/features/ModelList/ModelItem.tsx +67 -61
- package/src/app/[variants]/(main)/settings/provider/features/ModelList/ModelTitle/index.tsx +37 -10
- package/src/app/[variants]/(main)/settings/provider/features/ModelList/ProviderSettingsContext.ts +9 -0
- package/src/app/[variants]/(main)/settings/provider/features/ModelList/index.tsx +27 -17
- package/src/app/[variants]/(main)/settings/provider/features/ProviderConfig/Checker.tsx +47 -26
- package/src/app/[variants]/(main)/settings/provider/features/ProviderConfig/index.tsx +5 -1
- package/src/config/modelProviders/spark.ts +2 -0
- package/src/const/version.ts +1 -2
- package/src/database/server/models/aiModel.ts +6 -0
- package/src/locales/default/modelProvider.ts +5 -0
- package/src/server/routers/lambda/aiModel.ts +5 -0
- package/src/services/aiModel/client.ts +4 -0
- package/src/services/aiModel/server.test.ts +122 -0
- package/src/services/aiModel/server.ts +4 -0
- package/src/services/aiModel/type.ts +2 -0
- package/src/store/aiInfra/slices/aiModel/action.ts +5 -0
- package/src/store/aiInfra/slices/aiModel/selectors.ts +3 -0
- package/src/types/aiProvider.ts +7 -1
@@ -1,122 +1,122 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
"description": "
|
4
|
-
},
|
5
|
-
"ai360": {
|
6
|
-
"description": "360 AI 是 360 公司推出的 AI 模型和服务平台,提供多种先进的自然语言处理模型,包括 360GPT2 Pro、360GPT Pro、360GPT Turbo 和 360GPT Turbo Responsibility 8K。这些模型结合了大规模参数和多模态能力,广泛应用于文本生成、语义理解、对话系统与代码生成等领域。通过灵活的定价策略,360 AI 满足多样化用户需求,支持开发者集成,推动智能化应用的革新和发展。"
|
7
|
-
},
|
8
|
-
"anthropic": {
|
9
|
-
"description": "Anthropic 是一家专注于人工智能研究和开发的公司,提供了一系列先进的语言模型,如 Claude 3.5 Sonnet、Claude 3 Sonnet、Claude 3 Opus 和 Claude 3 Haiku。这些模型在智能、速度和成本之间取得了理想的平衡,适用于从企业级工作负载到快速响应的各种应用场景。Claude 3.5 Sonnet 作为其最新模型,在多项评估中表现优异,同时保持了较高的性价比。"
|
2
|
+
"openai": {
|
3
|
+
"description": "OpenAI 是全球领先的人工智能研究机构,其开发的模型如GPT系列推动了自然语言处理的前沿。OpenAI 致力于通过创新和高效的AI解决方案改变多个行业。他们的产品具有显著的性能和经济性,广泛用于研究、商业和创新应用。"
|
10
4
|
},
|
11
5
|
"azure": {
|
12
6
|
"description": "Azure 提供多种先进的AI模型,包括GPT-3.5和最新的GPT-4系列,支持多种数据类型和复杂任务,致力于安全、可靠和可持续的AI解决方案。"
|
13
7
|
},
|
14
|
-
"
|
15
|
-
"description": "
|
8
|
+
"ollama": {
|
9
|
+
"description": "Ollama 提供的模型广泛涵盖代码生成、数学运算、多语种处理和对话互动等领域,支持企业级和本地化部署的多样化需求。"
|
10
|
+
},
|
11
|
+
"anthropic": {
|
12
|
+
"description": "Anthropic 是一家专注于人工智能研究和开发的公司,提供了一系列先进的语言模型,如 Claude 3.5 Sonnet、Claude 3 Sonnet、Claude 3 Opus 和 Claude 3 Haiku。这些模型在智能、速度和成本之间取得了理想的平衡,适用于从企业级工作负载到快速响应的各种应用场景。Claude 3.5 Sonnet 作为其最新模型,在多项评估中表现优异,同时保持了较高的性价比。"
|
16
13
|
},
|
17
14
|
"bedrock": {
|
18
15
|
"description": "Bedrock 是亚马逊 AWS 提供的一项服务,专注于为企业提供先进的 AI 语言模型和视觉模型。其模型家族包括 Anthropic 的 Claude 系列、Meta 的 Llama 3.1 系列等,涵盖从轻量级到高性能的多种选择,支持文本生成、对话、图像处理等多种任务,适用于不同规模和需求的企业应用。"
|
19
16
|
},
|
20
|
-
"
|
21
|
-
"description": "
|
17
|
+
"google": {
|
18
|
+
"description": "Google 的 Gemini 系列是其最先进、通用的 AI模型,由 Google DeepMind 打造,专为多模态设计,支持文本、代码、图像、音频和视频的无缝理解与处理。适用于从数据中心到移动设备的多种环境,极大提升了AI模型的效率与应用广泛性。"
|
22
19
|
},
|
23
20
|
"deepseek": {
|
24
21
|
"description": "DeepSeek 是一家专注于人工智能技术研究和应用的公司,其最新模型 DeepSeek-V3 多项评测成绩超越 Qwen2.5-72B 和 Llama-3.1-405B 等开源模型,性能对齐领军闭源模型 GPT-4o 与 Claude-3.5-Sonnet。"
|
25
22
|
},
|
26
|
-
"
|
27
|
-
"description": "
|
23
|
+
"huggingface": {
|
24
|
+
"description": "HuggingFace Inference API 提供了一种快速且免费的方式,让您可以探索成千上万种模型,适用于各种任务。无论您是在为新应用程序进行原型设计,还是在尝试机器学习的功能,这个 API 都能让您即时访问多个领域的高性能模型。"
|
28
25
|
},
|
29
|
-
"
|
30
|
-
"description": "
|
26
|
+
"openrouter": {
|
27
|
+
"description": "OpenRouter 是一个提供多种前沿大模型接口的服务平台,支持 OpenAI、Anthropic、LLaMA 及更多,适合多样化的开发和应用需求。用户可根据自身需求灵活选择最优的模型和价格,助力AI体验的提升。"
|
31
28
|
},
|
32
|
-
"
|
33
|
-
"description": "
|
29
|
+
"cloudflare": {
|
30
|
+
"description": "在 Cloudflare 的全球网络上运行由无服务器 GPU 驱动的机器学习模型。"
|
34
31
|
},
|
35
32
|
"github": {
|
36
33
|
"description": "通过GitHub模型,开发人员可以成为AI工程师,并使用行业领先的AI模型进行构建。"
|
37
34
|
},
|
38
|
-
"
|
39
|
-
"description": "
|
40
|
-
},
|
41
|
-
"groq": {
|
42
|
-
"description": "Groq 的 LPU 推理引擎在最新的独立大语言模型(LLM)基准测试中表现卓越,以其惊人的速度和效率重新定义了 AI 解决方案的标准。Groq 是一种即时推理速度的代表,在基于云的部署中展现了良好的性能。"
|
43
|
-
},
|
44
|
-
"higress": {
|
45
|
-
"description": "Higress 是一款云原生 API 网关,在阿里内部为解决 Tengine reload 对长连接业务有损,以及 gRPC/Dubbo 负载均衡能力不足而诞生。"
|
46
|
-
},
|
47
|
-
"huggingface": {
|
48
|
-
"description": "HuggingFace Inference API 提供了一种快速且免费的方式,让您可以探索成千上万种模型,适用于各种任务。无论您是在为新应用程序进行原型设计,还是在尝试机器学习的功能,这个 API 都能让您即时访问多个领域的高性能模型。"
|
35
|
+
"novita": {
|
36
|
+
"description": "Novita AI 是一个提供多种大语言模型与 AI 图像生成的 API 服务的平台,灵活、可靠且具有成本效益。它支持 Llama3、Mistral 等最新的开源模型,并为生成式 AI 应用开发提供了全面、用户友好且自动扩展的 API 解决方案,适合 AI 初创公司的快速发展。"
|
49
37
|
},
|
50
|
-
"
|
51
|
-
"description": "
|
38
|
+
"togetherai": {
|
39
|
+
"description": "Together AI 致力于通过创新的 AI 模型实现领先的性能,提供广泛的自定义能力,包括快速扩展支持和直观的部署流程,满足企业的各种需求。"
|
52
40
|
},
|
53
|
-
"
|
54
|
-
"description": "
|
41
|
+
"fireworksai": {
|
42
|
+
"description": "Fireworks AI 是一家领先的高级语言模型服务商,专注于功能调用和多模态处理。其最新模型 Firefunction V2 基于 Llama-3,优化用于函数调用、对话及指令跟随。视觉语言模型 FireLLaVA-13B 支持图像和文本混合输入。其他 notable 模型包括 Llama 系列和 Mixtral 系列,提供高效的多语言指令跟随与生成支持。"
|
55
43
|
},
|
56
|
-
"
|
57
|
-
"description": "
|
44
|
+
"groq": {
|
45
|
+
"description": "Groq 的 LPU 推理引擎在最新的独立大语言模型(LLM)基准测试中表现卓越,以其惊人的速度和效率重新定义了 AI 解决方案的标准。Groq 是一种即时推理速度的代表,在基于云的部署中展现了良好的性能。"
|
58
46
|
},
|
59
|
-
"
|
60
|
-
"description": "
|
47
|
+
"perplexity": {
|
48
|
+
"description": "Perplexity 是一家领先的对话生成模型提供商,提供多种先进的Llama 3.1模型,支持在线和离线应用,特别适用于复杂的自然语言处理任务。"
|
61
49
|
},
|
62
50
|
"mistral": {
|
63
51
|
"description": "Mistral 提供先进的通用、专业和研究型模型,广泛应用于复杂推理、多语言任务、代码生成等领域,通过功能调用接口,用户可以集成自定义功能,实现特定应用。"
|
64
52
|
},
|
65
|
-
"
|
66
|
-
"description": "
|
53
|
+
"ai21": {
|
54
|
+
"description": "AI21 Labs 为企业构建基础模型和人工智能系统,加速生成性人工智能在生产中的应用。"
|
67
55
|
},
|
68
|
-
"
|
69
|
-
"description": "
|
56
|
+
"upstage": {
|
57
|
+
"description": "Upstage 专注于为各种商业需求开发AI模型,包括 Solar LLM 和文档 AI,旨在实现工作的人造通用智能(AGI)。通过 Chat API 创建简单的对话代理,并支持功能调用、翻译、嵌入以及特定领域应用。"
|
70
58
|
},
|
71
|
-
"
|
72
|
-
"description": "
|
59
|
+
"xai": {
|
60
|
+
"description": "xAI 是一家致力于构建人工智能以加速人类科学发现的公司。我们的使命是推动我们对宇宙的共同理解。"
|
73
61
|
},
|
74
|
-
"
|
75
|
-
"description": "
|
62
|
+
"qwen": {
|
63
|
+
"description": "通义千问是阿里云自主研发的超大规模语言模型,具有强大的自然语言理解和生成能力。它可以回答各种问题、创作文字内容、表达观点看法、撰写代码等,在多个领域发挥作用。"
|
76
64
|
},
|
77
|
-
"
|
78
|
-
"description": "
|
65
|
+
"wenxin": {
|
66
|
+
"description": "企业级一站式大模型与AI原生应用开发及服务平台,提供最全面易用的生成式人工智能模型开发、应用开发全流程工具链"
|
79
67
|
},
|
80
|
-
"
|
81
|
-
"description": "
|
68
|
+
"tencentcloud": {
|
69
|
+
"description": "知识引擎原子能力(LLM Knowledge Engine Atomic Power)基于知识引擎研发的知识问答全链路能力,面向企业及开发者,提供灵活组建及开发模型应用的能力。您可通过多款原子能力组建您专属的模型服务,调用文档解析、拆分、embedding、多轮改写等服务进行组装,定制企业专属 AI 业务。"
|
82
70
|
},
|
83
|
-
"
|
84
|
-
"description": "
|
71
|
+
"hunyuan": {
|
72
|
+
"description": "由腾讯研发的大语言模型,具备强大的中文创作能力,复杂语境下的逻辑推理能力,以及可靠的任务执行能力"
|
85
73
|
},
|
86
|
-
"
|
87
|
-
"description": "
|
74
|
+
"zhipu": {
|
75
|
+
"description": "智谱 AI 提供多模态与语言模型的开放平台,支持广泛的AI应用场景,包括文本处理、图像理解与编程辅助等。"
|
88
76
|
},
|
89
77
|
"siliconcloud": {
|
90
78
|
"description": "SiliconCloud,基于优秀开源基础模型的高性价比 GenAI 云服务"
|
91
79
|
},
|
80
|
+
"zeroone": {
|
81
|
+
"description": "零一万物致力于推动以人为本的AI 2.0技术革命,旨在通过大语言模型创造巨大的经济和社会价值,并开创新的AI生态与商业模式。"
|
82
|
+
},
|
92
83
|
"spark": {
|
93
84
|
"description": "科大讯飞星火大模型提供多领域、多语言的强大 AI 能力,利用先进的自然语言处理技术,构建适用于智能硬件、智慧医疗、智慧金融等多种垂直场景的创新应用。"
|
94
85
|
},
|
86
|
+
"sensenova": {
|
87
|
+
"description": "商汤日日新,依托商汤大装置的强大的基础支撑,提供高效易用的全栈大模型服务。"
|
88
|
+
},
|
95
89
|
"stepfun": {
|
96
90
|
"description": "阶级星辰大模型具备行业领先的多模态及复杂推理能力,支持超长文本理解和强大的自主调度搜索引擎功能。"
|
97
91
|
},
|
98
|
-
"
|
99
|
-
"description": "
|
92
|
+
"moonshot": {
|
93
|
+
"description": "Moonshot 是由北京月之暗面科技有限公司推出的开源平台,提供多种自然语言处理模型,应用领域广泛,包括但不限于内容创作、学术研究、智能推荐、医疗诊断等,支持长文本处理和复杂生成任务。"
|
100
94
|
},
|
101
|
-
"
|
102
|
-
"description": "
|
95
|
+
"baichuan": {
|
96
|
+
"description": "百川智能是一家专注于人工智能大模型研发的公司,其模型在国内知识百科、长文本处理和生成创作等中文任务上表现卓越,超越了国外主流模型。百川智能还具备行业领先的多模态能力,在多项权威评测中表现优异。其模型包括 Baichuan 4、Baichuan 3 Turbo 和 Baichuan 3 Turbo 128k 等,分别针对不同应用场景进行优化,提供高性价比的解决方案。"
|
103
97
|
},
|
104
|
-
"
|
105
|
-
"description": "
|
98
|
+
"minimax": {
|
99
|
+
"description": "MiniMax 是 2021 年成立的通用人工智能科技公司,致力于与用户共创智能。MiniMax 自主研发了不同模态的通用大模型,其中包括万亿参数的 MoE 文本大模型、语音大模型以及图像大模型。并推出了海螺 AI 等应用。"
|
106
100
|
},
|
107
|
-
"
|
108
|
-
"description": "
|
101
|
+
"lmstudio": {
|
102
|
+
"description": "LM Studio 是一个用于在您的计算机上开发和实验 LLMs 的桌面应用程序。"
|
109
103
|
},
|
110
|
-
"
|
111
|
-
"description": "
|
104
|
+
"internlm": {
|
105
|
+
"description": "致力于大模型研究与开发工具链的开源组织。为所有 AI 开发者提供高效、易用的开源平台,让最前沿的大模型与算法技术触手可及"
|
112
106
|
},
|
113
|
-
"
|
114
|
-
"description": "
|
107
|
+
"higress": {
|
108
|
+
"description": "Higress 是一款云原生 API 网关,在阿里内部为解决 Tengine reload 对长连接业务有损,以及 gRPC/Dubbo 负载均衡能力不足而诞生。"
|
115
109
|
},
|
116
|
-
"
|
117
|
-
"description": "
|
110
|
+
"giteeai": {
|
111
|
+
"description": "Gitee AI 的 Serverless API 为 AI 开发者提供开箱即用的大模型推理 API 服务。"
|
118
112
|
},
|
119
|
-
"
|
120
|
-
"description": "
|
113
|
+
"taichu": {
|
114
|
+
"description": "中科院自动化研究所和武汉人工智能研究院推出新一代多模态大模型,支持多轮问答、文本创作、图像生成、3D理解、信号分析等全面问答任务,拥有更强的认知、理解、创作能力,带来全新互动体验。"
|
115
|
+
},
|
116
|
+
"ai360": {
|
117
|
+
"description": "360 AI 是 360 公司推出的 AI 模型和服务平台,提供多种先进的自然语言处理模型,包括 360GPT2 Pro、360GPT Pro、360GPT Turbo 和 360GPT Turbo Responsibility 8K。这些模型结合了大规模参数和多模态能力,广泛应用于文本生成、语义理解、对话系统与代码生成等领域。通过灵活的定价策略,360 AI 满足多样化用户需求,支持开发者集成,推动智能化应用的革新和发展。"
|
118
|
+
},
|
119
|
+
"doubao": {
|
120
|
+
"description": "字节跳动推出的自研大模型。通过字节跳动内部50+业务场景实践验证,每日万亿级tokens大使用量持续打磨,提供多种模态能力,以优质模型效果为企业打造丰富的业务体验。"
|
121
121
|
}
|
122
|
-
}
|
122
|
+
}
|
package/locales/zh-CN/tool.json
CHANGED
package/locales/zh-CN/topic.json
CHANGED
@@ -276,6 +276,11 @@
|
|
276
276
|
"latestTime": "上次更新時間:{{time}}",
|
277
277
|
"noLatestTime": "尚未取得列表"
|
278
278
|
},
|
279
|
+
"resetAll": {
|
280
|
+
"conform": "確認重置當前模型的所有修改?重置後當前模型列表將會回到預設狀態",
|
281
|
+
"success": "重置成功",
|
282
|
+
"title": "重置所有修改"
|
283
|
+
},
|
279
284
|
"search": "搜尋模型...",
|
280
285
|
"searchResult": "搜尋到 {{count}} 個模型",
|
281
286
|
"title": "模型列表",
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lobehub/chat",
|
3
|
-
"version": "1.53.
|
3
|
+
"version": "1.53.9",
|
4
4
|
"description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
|
5
5
|
"keywords": [
|
6
6
|
"framework",
|
@@ -77,15 +77,11 @@ const useProviderCard = (): ProviderItem => {
|
|
77
77
|
) : (
|
78
78
|
<AutoComplete
|
79
79
|
options={[
|
80
|
+
'2024-10-21',
|
80
81
|
'2024-06-01',
|
81
|
-
'
|
82
|
-
'2024-
|
83
|
-
'2024-
|
84
|
-
'2024-03-01-preview',
|
85
|
-
'2024-02-15-preview',
|
86
|
-
'2023-10-01-preview',
|
87
|
-
'2023-06-01-preview',
|
88
|
-
'2023-05-15',
|
82
|
+
'2025-01-01-preview',
|
83
|
+
'2024-09-01-preview',
|
84
|
+
'2024-10-01-preview',
|
89
85
|
].map((i) => ({ label: i, value: i }))}
|
90
86
|
placeholder={'20XX-XX-XX'}
|
91
87
|
/>
|
@@ -3,7 +3,7 @@ import { ActionIcon, Tag, copyToClipboard } from '@lobehub/ui';
|
|
3
3
|
import { App, Switch, Typography } from 'antd';
|
4
4
|
import { createStyles, useTheme } from 'antd-style';
|
5
5
|
import { LucidePencil, TrashIcon } from 'lucide-react';
|
6
|
-
import { memo, useState } from 'react';
|
6
|
+
import { memo, use, useState } from 'react';
|
7
7
|
import { useTranslation } from 'react-i18next';
|
8
8
|
import { Flexbox } from 'react-layout-kit';
|
9
9
|
|
@@ -14,6 +14,7 @@ import { AiModelSourceEnum, AiProviderModelListItem, ChatModelPricing } from '@/
|
|
14
14
|
import { formatPriceByCurrency } from '@/utils/format';
|
15
15
|
|
16
16
|
import ModelConfigModal from './ModelConfigModal';
|
17
|
+
import { ProviderSettingsContext } from './ProviderSettingsContext';
|
17
18
|
|
18
19
|
export const useStyles = createStyles(({ css, token, cx }) => {
|
19
20
|
const config = css`
|
@@ -74,6 +75,7 @@ const ModelItem = memo<ModelItemProps>(
|
|
74
75
|
const { styles } = useStyles();
|
75
76
|
const { t } = useTranslation(['modelProvider', 'components', 'models', 'common']);
|
76
77
|
const theme = useTheme();
|
78
|
+
const { modelEditable } = use(ProviderSettingsContext);
|
77
79
|
|
78
80
|
const [activeAiProvider, isModelLoading, toggleModelEnabled, removeAiModel] = useAiInfraStore(
|
79
81
|
(s) => [
|
@@ -191,40 +193,42 @@ const ModelItem = memo<ModelItemProps>(
|
|
191
193
|
</Flexbox>
|
192
194
|
</Flexbox>
|
193
195
|
<Flexbox align={'center'} gap={4} horizontal>
|
194
|
-
|
195
|
-
<
|
196
|
-
icon={LucidePencil}
|
197
|
-
onClick={(e) => {
|
198
|
-
e.stopPropagation();
|
199
|
-
setShowConfig(true);
|
200
|
-
}}
|
201
|
-
size={'small'}
|
202
|
-
title={t('providerModels.item.config')}
|
203
|
-
/>
|
204
|
-
{source !== AiModelSourceEnum.Builtin && (
|
196
|
+
{modelEditable && (
|
197
|
+
<Flexbox className={styles.config} horizontal style={{ opacity: 1 }}>
|
205
198
|
<ActionIcon
|
206
|
-
icon={
|
207
|
-
onClick={() => {
|
208
|
-
|
209
|
-
|
210
|
-
okButtonProps: {
|
211
|
-
danger: true,
|
212
|
-
type: 'primary',
|
213
|
-
},
|
214
|
-
onOk: async () => {
|
215
|
-
await removeAiModel(id, activeAiProvider!);
|
216
|
-
message.success(t('providerModels.item.delete.success'));
|
217
|
-
},
|
218
|
-
title: t('providerModels.item.delete.confirm', {
|
219
|
-
displayName: displayName || id,
|
220
|
-
}),
|
221
|
-
});
|
199
|
+
icon={LucidePencil}
|
200
|
+
onClick={(e) => {
|
201
|
+
e.stopPropagation();
|
202
|
+
setShowConfig(true);
|
222
203
|
}}
|
223
204
|
size={'small'}
|
224
|
-
title={t('providerModels.item.
|
205
|
+
title={t('providerModels.item.config')}
|
225
206
|
/>
|
226
|
-
|
227
|
-
|
207
|
+
{source !== AiModelSourceEnum.Builtin && (
|
208
|
+
<ActionIcon
|
209
|
+
icon={TrashIcon}
|
210
|
+
onClick={() => {
|
211
|
+
modal.confirm({
|
212
|
+
centered: true,
|
213
|
+
okButtonProps: {
|
214
|
+
danger: true,
|
215
|
+
type: 'primary',
|
216
|
+
},
|
217
|
+
onOk: async () => {
|
218
|
+
await removeAiModel(id, activeAiProvider!);
|
219
|
+
message.success(t('providerModels.item.delete.success'));
|
220
|
+
},
|
221
|
+
title: t('providerModels.item.delete.confirm', {
|
222
|
+
displayName: displayName || id,
|
223
|
+
}),
|
224
|
+
});
|
225
|
+
}}
|
226
|
+
size={'small'}
|
227
|
+
title={t('providerModels.item.delete.title')}
|
228
|
+
/>
|
229
|
+
)}
|
230
|
+
</Flexbox>
|
231
|
+
)}
|
228
232
|
<Switch
|
229
233
|
checked={checked}
|
230
234
|
loading={isModelLoading}
|
@@ -254,40 +258,42 @@ const ModelItem = memo<ModelItemProps>(
|
|
254
258
|
<Tag onClick={copyModelId} style={{ cursor: 'pointer', marginRight: 0 }}>
|
255
259
|
{id}
|
256
260
|
</Tag>
|
257
|
-
|
258
|
-
<
|
259
|
-
icon={LucidePencil}
|
260
|
-
onClick={(e) => {
|
261
|
-
e.stopPropagation();
|
262
|
-
setShowConfig(true);
|
263
|
-
}}
|
264
|
-
size={'small'}
|
265
|
-
title={t('providerModels.item.config')}
|
266
|
-
/>
|
267
|
-
{source !== AiModelSourceEnum.Builtin && (
|
261
|
+
{modelEditable && (
|
262
|
+
<Flexbox className={styles.config} horizontal>
|
268
263
|
<ActionIcon
|
269
|
-
icon={
|
270
|
-
onClick={() => {
|
271
|
-
|
272
|
-
|
273
|
-
okButtonProps: {
|
274
|
-
danger: true,
|
275
|
-
type: 'primary',
|
276
|
-
},
|
277
|
-
onOk: async () => {
|
278
|
-
await removeAiModel(id, activeAiProvider!);
|
279
|
-
message.success(t('providerModels.item.delete.success'));
|
280
|
-
},
|
281
|
-
title: t('providerModels.item.delete.confirm', {
|
282
|
-
displayName: displayName || id,
|
283
|
-
}),
|
284
|
-
});
|
264
|
+
icon={LucidePencil}
|
265
|
+
onClick={(e) => {
|
266
|
+
e.stopPropagation();
|
267
|
+
setShowConfig(true);
|
285
268
|
}}
|
286
269
|
size={'small'}
|
287
|
-
title={t('providerModels.item.
|
270
|
+
title={t('providerModels.item.config')}
|
288
271
|
/>
|
289
|
-
|
290
|
-
|
272
|
+
{source !== AiModelSourceEnum.Builtin && (
|
273
|
+
<ActionIcon
|
274
|
+
icon={TrashIcon}
|
275
|
+
onClick={() => {
|
276
|
+
modal.confirm({
|
277
|
+
centered: true,
|
278
|
+
okButtonProps: {
|
279
|
+
danger: true,
|
280
|
+
type: 'primary',
|
281
|
+
},
|
282
|
+
onOk: async () => {
|
283
|
+
await removeAiModel(id, activeAiProvider!);
|
284
|
+
message.success(t('providerModels.item.delete.success'));
|
285
|
+
},
|
286
|
+
title: t('providerModels.item.delete.confirm', {
|
287
|
+
displayName: displayName || id,
|
288
|
+
}),
|
289
|
+
});
|
290
|
+
}}
|
291
|
+
size={'small'}
|
292
|
+
title={t('providerModels.item.delete.title')}
|
293
|
+
/>
|
294
|
+
)}
|
295
|
+
</Flexbox>
|
296
|
+
)}
|
291
297
|
</Flexbox>
|
292
298
|
<Flexbox align={'baseline'} gap={8} horizontal>
|
293
299
|
{content.length > 0 && (
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { ActionIcon, Icon } from '@lobehub/ui';
|
2
|
-
import { Button, Skeleton, Space, Typography } from 'antd';
|
2
|
+
import { App, Button, Dropdown, Skeleton, Space, Typography } from 'antd';
|
3
3
|
import { useTheme } from 'antd-style';
|
4
|
-
import { CircleX, LucideRefreshCcwDot, PlusIcon } from 'lucide-react';
|
4
|
+
import { CircleX, EllipsisVertical, LucideRefreshCcwDot, PlusIcon } from 'lucide-react';
|
5
5
|
import { memo, useState } from 'react';
|
6
6
|
import { useTranslation } from 'react-i18next';
|
7
7
|
import { Flexbox } from 'react-layout-kit';
|
@@ -23,6 +23,7 @@ const ModelTitle = memo<ModelFetcherProps>(
|
|
23
23
|
({ provider, showAddNewModel = true, showModelFetcher = true }) => {
|
24
24
|
const theme = useTheme();
|
25
25
|
const { t } = useTranslation('modelProvider');
|
26
|
+
const { modal, message } = App.useApp();
|
26
27
|
const [
|
27
28
|
searchKeyword,
|
28
29
|
totalModels,
|
@@ -30,6 +31,7 @@ const ModelTitle = memo<ModelFetcherProps>(
|
|
30
31
|
hasRemoteModels,
|
31
32
|
fetchRemoteModelList,
|
32
33
|
clearObtainedModels,
|
34
|
+
clearModelsByProvider,
|
33
35
|
useFetchAiProviderModels,
|
34
36
|
] = useAiInfraStore((s) => [
|
35
37
|
s.modelSearchKeyword,
|
@@ -38,6 +40,7 @@ const ModelTitle = memo<ModelFetcherProps>(
|
|
38
40
|
aiModelSelectors.hasRemoteModels(s),
|
39
41
|
s.fetchRemoteModelList,
|
40
42
|
s.clearRemoteModels,
|
43
|
+
s.clearModelsByProvider,
|
41
44
|
s.useFetchAiProviderModels,
|
42
45
|
]);
|
43
46
|
|
@@ -123,15 +126,39 @@ const ModelTitle = memo<ModelFetcherProps>(
|
|
123
126
|
</Button>
|
124
127
|
)}
|
125
128
|
{showAddNewModel && (
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
129
|
+
<>
|
130
|
+
<Button
|
131
|
+
icon={<Icon icon={PlusIcon} />}
|
132
|
+
onClick={() => {
|
133
|
+
setShowModal(true);
|
134
|
+
}}
|
135
|
+
size={'small'}
|
136
|
+
/>
|
137
|
+
<CreateNewModelModal open={showModal} setOpen={setShowModal} />
|
138
|
+
</>
|
133
139
|
)}
|
134
|
-
<
|
140
|
+
<Dropdown
|
141
|
+
menu={{
|
142
|
+
items: [
|
143
|
+
{
|
144
|
+
key: 'reset',
|
145
|
+
label: t('providerModels.list.resetAll.title'),
|
146
|
+
onClick: async () => {
|
147
|
+
modal.confirm({
|
148
|
+
content: t('providerModels.list.resetAll.conform'),
|
149
|
+
onOk: async () => {
|
150
|
+
await clearModelsByProvider(provider);
|
151
|
+
message.success(t('providerModels.list.resetAll.success'));
|
152
|
+
},
|
153
|
+
title: t('providerModels.list.resetAll.title'),
|
154
|
+
});
|
155
|
+
},
|
156
|
+
},
|
157
|
+
],
|
158
|
+
}}
|
159
|
+
>
|
160
|
+
<Button icon={<Icon icon={EllipsisVertical} />} size={'small'} />
|
161
|
+
</Dropdown>
|
135
162
|
</Space.Compact>
|
136
163
|
</Flexbox>
|
137
164
|
)}
|
package/src/app/[variants]/(main)/settings/provider/features/ModelList/ProviderSettingsContext.ts
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
import { createContext } from 'react';
|
2
|
+
|
3
|
+
export interface ProviderSettingsContextValue {
|
4
|
+
modelEditable?: boolean;
|
5
|
+
showAddNewModel?: boolean;
|
6
|
+
showModelFetcher?: boolean;
|
7
|
+
}
|
8
|
+
|
9
|
+
export const ProviderSettingsContext = createContext<ProviderSettingsContextValue>({});
|
@@ -3,6 +3,7 @@
|
|
3
3
|
import { Suspense, memo } from 'react';
|
4
4
|
import { Flexbox } from 'react-layout-kit';
|
5
5
|
|
6
|
+
import { ProviderSettingsContext } from '@/app/[variants]/(main)/settings/provider/features/ModelList/ProviderSettingsContext';
|
6
7
|
import { useIsMobile } from '@/hooks/useIsMobile';
|
7
8
|
import { aiModelSelectors, useAiInfraStore } from '@/store/aiInfra';
|
8
9
|
|
@@ -13,7 +14,11 @@ import ModelTitle from './ModelTitle';
|
|
13
14
|
import SearchResult from './SearchResult';
|
14
15
|
import SkeletonList from './SkeletonList';
|
15
16
|
|
16
|
-
|
17
|
+
interface ContentProps {
|
18
|
+
id: string;
|
19
|
+
}
|
20
|
+
|
21
|
+
const Content = memo<ContentProps>(({ id }) => {
|
17
22
|
const [isSearching, isEmpty, useFetchAiProviderModels] = useAiInfraStore((s) => [
|
18
23
|
!!s.modelSearchKeyword,
|
19
24
|
aiModelSelectors.isEmptyAiProviderModelList(s),
|
@@ -38,25 +43,30 @@ const Content = memo<{ id: string }>(({ id }) => {
|
|
38
43
|
|
39
44
|
interface ModelListProps {
|
40
45
|
id: string;
|
46
|
+
modelEditable?: boolean;
|
41
47
|
showAddNewModel?: boolean;
|
42
48
|
showModelFetcher?: boolean;
|
43
49
|
}
|
44
50
|
|
45
|
-
const ModelList = memo<ModelListProps>(
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
<
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
51
|
+
const ModelList = memo<ModelListProps>(
|
52
|
+
({ id, showModelFetcher, showAddNewModel, modelEditable = true }) => {
|
53
|
+
const mobile = useIsMobile();
|
54
|
+
|
55
|
+
return (
|
56
|
+
<ProviderSettingsContext value={{ modelEditable, showAddNewModel, showModelFetcher }}>
|
57
|
+
<Flexbox gap={16} paddingInline={mobile ? 12 : 0}>
|
58
|
+
<ModelTitle
|
59
|
+
provider={id}
|
60
|
+
showAddNewModel={showAddNewModel}
|
61
|
+
showModelFetcher={showModelFetcher}
|
62
|
+
/>
|
63
|
+
<Suspense fallback={<SkeletonList />}>
|
64
|
+
<Content id={id} />
|
65
|
+
</Suspense>
|
66
|
+
</Flexbox>
|
67
|
+
</ProviderSettingsContext>
|
68
|
+
);
|
69
|
+
},
|
70
|
+
);
|
61
71
|
|
62
72
|
export default ModelList;
|