Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💄 style: add kimi-latest for Moonshot #6295

Merged
merged 5 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 36 additions & 6 deletions src/config/aiModels/moonshot.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,42 @@
import { AIChatModelCard } from '@/types/aiModel';

const moonshotChatModels: AIChatModelCard[] = [
{
abilities: {
functionCall: true,
vision: true,
},
contextWindowTokens: 131_072,
description:
'Kimi 智能助手产品使用最新的 Kimi 大模型,可能包含尚未稳定的特性。支持图片理解,同时会自动根据请求的上下文长度选择 8k/32k/128k 模型作为计费模型',
displayName: 'Kimi Latest',
enabled: true,
id: 'kimi-latest',
pricing: {
cachedInput: 1,
currency: 'CNY',
input: 60,
output: 60,
},
releasedAt: '2025-02-17',
type: 'chat',
},
{
abilities: {
functionCall: true,
},
contextWindowTokens: 131_072,
description:
'Moonshot V1 Auto 可以根据当前上下文占用的 Tokens 数量来选择合适的模型',
displayName: 'Moonshot V1 Auto',
id: 'moonshot-v1-auto',
pricing: {
currency: 'CNY',
input: 60,
output: 60,
},
type: 'chat',
},
{
abilities: {
functionCall: true,
Expand All @@ -9,7 +45,6 @@ const moonshotChatModels: AIChatModelCard[] = [
description:
'Moonshot V1 8K 专为生成短文本任务设计,具有高效的处理性能,能够处理8,192个tokens,非常适合简短对话、速记和快速内容生成。',
displayName: 'Moonshot V1 8K',
enabled: true,
id: 'moonshot-v1-8k',
pricing: {
currency: 'CNY',
Expand All @@ -26,7 +61,6 @@ const moonshotChatModels: AIChatModelCard[] = [
description:
'Moonshot V1 32K 提供中等长度的上下文处理能力,能够处理32,768个tokens,特别适合生成各种长文档和复杂对话,应用于内容创作、报告生成和对话系统等领域。',
displayName: 'Moonshot V1 32K',
enabled: true,
id: 'moonshot-v1-32k',
pricing: {
currency: 'CNY',
Expand All @@ -43,7 +77,6 @@ const moonshotChatModels: AIChatModelCard[] = [
description:
'Moonshot V1 128K 是一款拥有超长上下文处理能力的模型,适用于生成超长文本,满足复杂的生成任务需求,能够处理多达128,000个tokens的内容,非常适合科研、学术和大型文档生成等应用场景。',
displayName: 'Moonshot V1 128K',
enabled: true,
id: 'moonshot-v1-128k',
pricing: {
currency: 'CNY',
Expand All @@ -61,7 +94,6 @@ const moonshotChatModels: AIChatModelCard[] = [
description:
'Kimi 视觉模型(包括 moonshot-v1-8k-vision-preview/moonshot-v1-32k-vision-preview/moonshot-v1-128k-vision-preview 等)能够理解图片内容,包括图片文字、图片颜色和物体形状等内容。',
displayName: 'Moonshot V1 8K Vision Preview',
enabled: true,
id: 'moonshot-v1-8k-vision-preview',
pricing: {
currency: 'CNY',
Expand All @@ -80,7 +112,6 @@ const moonshotChatModels: AIChatModelCard[] = [
description:
'Kimi 视觉模型(包括 moonshot-v1-8k-vision-preview/moonshot-v1-32k-vision-preview/moonshot-v1-128k-vision-preview 等)能够理解图片内容,包括图片文字、图片颜色和物体形状等内容。',
displayName: 'Moonshot V1 32K Vision Preview',
enabled: true,
id: 'moonshot-v1-32k-vision-preview',
pricing: {
currency: 'CNY',
Expand All @@ -99,7 +130,6 @@ const moonshotChatModels: AIChatModelCard[] = [
description:
'Kimi 视觉模型(包括 moonshot-v1-8k-vision-preview/moonshot-v1-32k-vision-preview/moonshot-v1-128k-vision-preview 等)能够理解图片内容,包括图片文字、图片颜色和物体形状等内容。',
displayName: 'Moonshot V1 128K Vision Preview',
enabled: true,
id: 'moonshot-v1-128k-vision-preview',
pricing: {
currency: 'CNY',
Expand Down
2 changes: 1 addition & 1 deletion src/config/modelProviders/moonshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const Moonshot: ModelProviderCard = {
id: 'moonshot-v1-128k',
},
],
checkModel: 'moonshot-v1-8k',
checkModel: 'kimi-latest',
description:
'Moonshot 是由北京月之暗面科技有限公司推出的开源平台,提供多种自然语言处理模型,应用领域广泛,包括但不限于内容创作、学术研究、智能推荐、医疗诊断等,支持长文本处理和复杂生成任务。',
id: 'moonshot',
Expand Down
15 changes: 13 additions & 2 deletions src/libs/agent-runtime/moonshot/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ export const LobeMoonshotAI = LobeOpenAICompatibleFactory({
models: async ({ client }) => {
const { LOBE_DEFAULT_MODEL_LIST } = await import('@/config/aiModels');

const functionCallKeywords = [
'moonshot-v1',
'kimi-latest',
]

const visionKeywords = [
'kimi-latest',
'vision',
]

const modelsPage = await client.models.list() as any;
const modelList: MoonshotModelCard[] = modelsPage.data;

Expand All @@ -39,14 +49,15 @@ export const LobeMoonshotAI = LobeOpenAICompatibleFactory({
displayName: knownModel?.displayName ?? undefined,
enabled: knownModel?.enabled || false,
functionCall:
knownModel?.abilities?.functionCall
functionCallKeywords.some(keyword => model.id.toLowerCase().includes(keyword))
|| knownModel?.abilities?.functionCall
|| false,
id: model.id,
reasoning:
knownModel?.abilities?.reasoning
|| false,
vision:
model.id.toLowerCase().includes('vision')
visionKeywords.some(keyword => model.id.toLowerCase().includes(keyword))
|| knownModel?.abilities?.vision
|| false,
};
Expand Down