Skip to content

Commit def0c8c

Browse files
hezhijie0327likaiqiang
authored andcommitted
💄 style: add kimi-latest for Moonshot (lobehub#6295)
* 💄 style: add `kimi-latest` for Moonshot * 💄 style: update model list * 💄 style: update model desc and cachedInput * 💄 style: fix no model enabled * 💄 style: update check model
1 parent 38fbf01 commit def0c8c

File tree

3 files changed

+50
-9
lines changed

3 files changed

+50
-9
lines changed

src/config/aiModels/moonshot.ts

+36-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,42 @@
11
import { AIChatModelCard } from '@/types/aiModel';
22

33
const moonshotChatModels: AIChatModelCard[] = [
4+
{
5+
abilities: {
6+
functionCall: true,
7+
vision: true,
8+
},
9+
contextWindowTokens: 131_072,
10+
description:
11+
'Kimi 智能助手产品使用最新的 Kimi 大模型,可能包含尚未稳定的特性。支持图片理解,同时会自动根据请求的上下文长度选择 8k/32k/128k 模型作为计费模型',
12+
displayName: 'Kimi Latest',
13+
enabled: true,
14+
id: 'kimi-latest',
15+
pricing: {
16+
cachedInput: 1,
17+
currency: 'CNY',
18+
input: 60,
19+
output: 60,
20+
},
21+
releasedAt: '2025-02-17',
22+
type: 'chat',
23+
},
24+
{
25+
abilities: {
26+
functionCall: true,
27+
},
28+
contextWindowTokens: 131_072,
29+
description:
30+
'Moonshot V1 Auto 可以根据当前上下文占用的 Tokens 数量来选择合适的模型',
31+
displayName: 'Moonshot V1 Auto',
32+
id: 'moonshot-v1-auto',
33+
pricing: {
34+
currency: 'CNY',
35+
input: 60,
36+
output: 60,
37+
},
38+
type: 'chat',
39+
},
440
{
541
abilities: {
642
functionCall: true,
@@ -9,7 +45,6 @@ const moonshotChatModels: AIChatModelCard[] = [
945
description:
1046
'Moonshot V1 8K 专为生成短文本任务设计,具有高效的处理性能,能够处理8,192个tokens,非常适合简短对话、速记和快速内容生成。',
1147
displayName: 'Moonshot V1 8K',
12-
enabled: true,
1348
id: 'moonshot-v1-8k',
1449
pricing: {
1550
currency: 'CNY',
@@ -26,7 +61,6 @@ const moonshotChatModels: AIChatModelCard[] = [
2661
description:
2762
'Moonshot V1 32K 提供中等长度的上下文处理能力,能够处理32,768个tokens,特别适合生成各种长文档和复杂对话,应用于内容创作、报告生成和对话系统等领域。',
2863
displayName: 'Moonshot V1 32K',
29-
enabled: true,
3064
id: 'moonshot-v1-32k',
3165
pricing: {
3266
currency: 'CNY',
@@ -43,7 +77,6 @@ const moonshotChatModels: AIChatModelCard[] = [
4377
description:
4478
'Moonshot V1 128K 是一款拥有超长上下文处理能力的模型,适用于生成超长文本,满足复杂的生成任务需求,能够处理多达128,000个tokens的内容,非常适合科研、学术和大型文档生成等应用场景。',
4579
displayName: 'Moonshot V1 128K',
46-
enabled: true,
4780
id: 'moonshot-v1-128k',
4881
pricing: {
4982
currency: 'CNY',
@@ -61,7 +94,6 @@ const moonshotChatModels: AIChatModelCard[] = [
6194
description:
6295
'Kimi 视觉模型(包括 moonshot-v1-8k-vision-preview/moonshot-v1-32k-vision-preview/moonshot-v1-128k-vision-preview 等)能够理解图片内容,包括图片文字、图片颜色和物体形状等内容。',
6396
displayName: 'Moonshot V1 8K Vision Preview',
64-
enabled: true,
6597
id: 'moonshot-v1-8k-vision-preview',
6698
pricing: {
6799
currency: 'CNY',
@@ -80,7 +112,6 @@ const moonshotChatModels: AIChatModelCard[] = [
80112
description:
81113
'Kimi 视觉模型(包括 moonshot-v1-8k-vision-preview/moonshot-v1-32k-vision-preview/moonshot-v1-128k-vision-preview 等)能够理解图片内容,包括图片文字、图片颜色和物体形状等内容。',
82114
displayName: 'Moonshot V1 32K Vision Preview',
83-
enabled: true,
84115
id: 'moonshot-v1-32k-vision-preview',
85116
pricing: {
86117
currency: 'CNY',
@@ -99,7 +130,6 @@ const moonshotChatModels: AIChatModelCard[] = [
99130
description:
100131
'Kimi 视觉模型(包括 moonshot-v1-8k-vision-preview/moonshot-v1-32k-vision-preview/moonshot-v1-128k-vision-preview 等)能够理解图片内容,包括图片文字、图片颜色和物体形状等内容。',
101132
displayName: 'Moonshot V1 128K Vision Preview',
102-
enabled: true,
103133
id: 'moonshot-v1-128k-vision-preview',
104134
pricing: {
105135
currency: 'CNY',

src/config/modelProviders/moonshot.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const Moonshot: ModelProviderCard = {
3131
id: 'moonshot-v1-128k',
3232
},
3333
],
34-
checkModel: 'moonshot-v1-8k',
34+
checkModel: 'kimi-latest',
3535
description:
3636
'Moonshot 是由北京月之暗面科技有限公司推出的开源平台,提供多种自然语言处理模型,应用领域广泛,包括但不限于内容创作、学术研究、智能推荐、医疗诊断等,支持长文本处理和复杂生成任务。',
3737
id: 'moonshot',

src/libs/agent-runtime/moonshot/index.ts

+13-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ export const LobeMoonshotAI = LobeOpenAICompatibleFactory({
2727
models: async ({ client }) => {
2828
const { LOBE_DEFAULT_MODEL_LIST } = await import('@/config/aiModels');
2929

30+
const functionCallKeywords = [
31+
'moonshot-v1',
32+
'kimi-latest',
33+
]
34+
35+
const visionKeywords = [
36+
'kimi-latest',
37+
'vision',
38+
]
39+
3040
const modelsPage = await client.models.list() as any;
3141
const modelList: MoonshotModelCard[] = modelsPage.data;
3242

@@ -39,14 +49,15 @@ export const LobeMoonshotAI = LobeOpenAICompatibleFactory({
3949
displayName: knownModel?.displayName ?? undefined,
4050
enabled: knownModel?.enabled || false,
4151
functionCall:
42-
knownModel?.abilities?.functionCall
52+
functionCallKeywords.some(keyword => model.id.toLowerCase().includes(keyword))
53+
|| knownModel?.abilities?.functionCall
4354
|| false,
4455
id: model.id,
4556
reasoning:
4657
knownModel?.abilities?.reasoning
4758
|| false,
4859
vision:
49-
model.id.toLowerCase().includes('vision')
60+
visionKeywords.some(keyword => model.id.toLowerCase().includes(keyword))
5061
|| knownModel?.abilities?.vision
5162
|| false,
5263
};

0 commit comments

Comments
 (0)