🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
💄 style: add `intern-s2-preview` support, support `thinking_mode` (#15308)
Zhijie Hed75e193ea024
diff --git a/packages/model-bank/src/aiModels/internlm.ts b/packages/model-bank/src/aiModels/internlm.tsindex d184354381d..cb0162079a2 100644--- a/packages/model-bank/src/aiModels/internlm.ts+++ b/packages/model-bank/src/aiModels/internlm.ts@@ -11,7 +11,7 @@ const internlmChatModels: AIChatModelCard[] = [},contextWindowTokens: 262_144,description:- 'By default, it points to our latest released Intern series model, currently set to intern-s1-pro.',+ 'By default, it points to our latest released Intern series model, currently set to intern-s2-preview.',displayName: 'Intern',id: 'intern-latest',pricing: {@@ -20,13 +20,41 @@ const internlmChatModels: AIChatModelCard[] = [{ name: 'textOutput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },],},- releasedAt: '2026-02-04',+ releasedAt: '2026-05-22',+ settings: {+ extendParams: ['enableReasoning'],+ },+ type: 'chat',+ },+ {+ abilities: {+ functionCall: true,+ reasoning: true,+ vision: true,+ },+ contextWindowTokens: 262_144,+ description:+ 'Our newly released 35B-A3B scientific multimodal reasoning model supports a 256K context window. Through task scaling and architectural optimization, it is specifically designed to enhance scientific discovery and general-purpose agent capabilities.',+ displayName: 'Intern-S2-Preview',+ enabled: true,+ id: 'intern-s2-preview',+ pricing: {+ units: [+ { name: 'textInput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },+ { name: 'textOutput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },+ ],+ },+ releasedAt: '2026-05-22',+ settings: {+ extendParams: ['enableReasoning'],+ },type: 'chat',},{abilities: {functionCall: true,reasoning: true,+ search: true,vision: true,},contextWindowTokens: 262_144,@@ -42,6 +70,10 @@ const internlmChatModels: AIChatModelCard[] = [],},releasedAt: '2026-02-04',+ settings: {+ extendParams: ['enableReasoning'],+ searchImpl: 'internal',+ },type: 'chat',},{@@ -63,6 +95,9 @@ const internlmChatModels: AIChatModelCard[] = [],},releasedAt: '2025-07-26',+ settings: {+ extendParams: ['enableReasoning'],+ },type: 'chat',},{@@ -84,6 +119,9 @@ const internlmChatModels: AIChatModelCard[] = [],},releasedAt: '2025-08-20',+ settings: {+ extendParams: ['enableReasoning'],+ },type: 'chat',},{@@ -112,7 +150,6 @@ const internlmChatModels: AIChatModelCard[] = [description:'Our newly released multimodal large model features enhanced image-and-text understanding and long-sequence image comprehension capabilities, achieving performance comparable to leading closed-source models.',displayName: 'InternVL3.5-241B-A28B',- enabled: true,id: 'internvl3.5-241b-a28b',pricing: {units: [diff --git a/packages/model-bank/src/modelProviders/internlm.ts b/packages/model-bank/src/modelProviders/internlm.tsindex 88f14d607ff..8eb57066d4b 100644--- a/packages/model-bank/src/modelProviders/internlm.ts+++ b/packages/model-bank/src/modelProviders/internlm.ts@@ -2,14 +2,11 @@ import type { ModelProviderCard } from '@/types/llm';const InternLM: ModelProviderCard = {chatModels: [],- checkModel: 'internlm2.5-latest',+ checkModel: 'intern-latest',description:'An open-source organization focused on large-model research and tooling, providing an efficient, easy-to-use platform that makes cutting-edge models and algorithms accessible.',- disableBrowserRequest: true,id: 'internlm',- modelList: { showModelFetcher: true },- modelsUrl:- 'https://internlm.intern-ai.org.cn/doc/docs/Models#%E8%8E%B7%E5%8F%96%E6%A8%A1%E5%9E%8B%E5%88%97%E8%A1%A8',+ modelsUrl: 'https://internlm.intern-ai.org.cn/api/document',name: 'InternLM',settings: {disableBrowserRequest: true,diff --git a/packages/model-runtime/src/providers/internlm/index.test.ts b/packages/model-runtime/src/providers/internlm/index.test.tsindex abc4603e386..699ad690893 100644--- a/packages/model-runtime/src/providers/internlm/index.test.ts+++ b/packages/model-runtime/src/providers/internlm/index.test.ts@@ -53,66 +53,6 @@ describe('LobeInternLMAI - custom features', () => {});});- describe('handlePayload', () => {- it('should disable streaming when tools are present', () => {- const payload = {- model: 'internlm2_5-7b-chat',- messages: [{ role: 'user' as const, content: 'Hello' }],- stream: true,- tools: [- {- type: 'function' as const,- function: {- name: 'test',- description: 'test function',- },- },- ],- };-- const result = params.chatCompletion.handlePayload!(payload);- expect(result.stream).toBe(false);- });-- it('should enable streaming when no tools are present', () => {- const payload = {- model: 'internlm2_5-7b-chat',- messages: [{ role: 'user' as const, content: 'Hello' }],- stream: true,- };-- const result = params.chatCompletion.handlePayload!(payload);- expect(result.stream).toBe(true);- });-- it('should keep streaming disabled when initially false and no tools', () => {- const payload = {- model: 'internlm2_5-7b-chat',- messages: [{ role: 'user' as const, content: 'Hello' }],- stream: false,- };-- const result = params.chatCompletion.handlePayload!(payload);- expect(result.stream).toBe(true);- });-- it('should preserve other payload properties', () => {- const payload = {- model: 'internlm2_5-7b-chat',- messages: [{ role: 'user' as const, content: 'Hello' }],- stream: true,- temperature: 0.7,- max_tokens: 100,- };-- const result = params.chatCompletion.handlePayload!(payload);- expect(result.model).toBe('internlm2_5-7b-chat');- expect(result.messages).toEqual(payload.messages);- expect(result.temperature).toBe(0.7);- expect(result.max_tokens).toBe(100);- });- });-describe('models', () => {it('should fetch and process models', async () => {const mockClient = {@@ -229,7 +169,7 @@ describe('LobeInternLMAI - custom features', () => {expect(model.id).toBe('custom-model');expect(model.contextWindowTokens).toBeUndefined();- expect(model.displayName).toBeUndefined();+ expect(model.displayName).toBe('custom-model');expect(model.enabled).toBe(false);expect(model.functionCall).toBe(false);expect(model.vision).toBe(false);diff --git a/packages/model-runtime/src/providers/internlm/index.ts b/packages/model-runtime/src/providers/internlm/index.tsindex 78a0ed6aa4c..f4c5490db05 100644--- a/packages/model-runtime/src/providers/internlm/index.ts+++ b/packages/model-runtime/src/providers/internlm/index.ts@@ -1,8 +1,8 @@-import type { ChatModelCard } from '@lobechat/types';import { ModelProvider } from 'model-bank';import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';+import { MODEL_LIST_CONFIGS, processModelList } from '../../utils/modelParse';export interface InternLMModelCard {id: string;@@ -12,9 +12,13 @@ export const params = {baseURL: 'https://chat.intern-ai.org.cn/api/v1',chatCompletion: {handlePayload: (payload) => {+ const { thinking, ...rest } = payload as any;+return {- ...payload,- stream: !payload.tools,+ ...rest,+ ...(thinking?.type !== undefined && {+ thinking_mode: thinking.type === 'enabled',+ }),} as any;},},@@ -22,38 +26,10 @@ export const params = {chatCompletion: () => process.env.DEBUG_INTERNLM_CHAT_COMPLETION === '1',},models: async ({ client }) => {- const { LOBE_DEFAULT_MODEL_LIST } = await import('model-bank');-- const functionCallKeywords = ['internlm'];-- const visionKeywords = ['internvl'];-const modelsPage = (await client.models.list()) as any;const modelList: InternLMModelCard[] = modelsPage.data;- return modelList- .filter((model) => model && model.id)- .map((model) => {- const knownModel = LOBE_DEFAULT_MODEL_LIST.find(- (m) => model.id.toLowerCase() === m.id.toLowerCase(),- );-- return {- contextWindowTokens: knownModel?.contextWindowTokens ?? undefined,- displayName: knownModel?.displayName ?? undefined,- enabled: knownModel?.enabled || false,- functionCall:- functionCallKeywords.some((keyword) => model.id.toLowerCase().includes(keyword)) ||- knownModel?.abilities?.functionCall ||- false,- id: model.id,- reasoning: knownModel?.abilities?.reasoning || false,- vision:- visionKeywords.some((keyword) => model.id.toLowerCase().includes(keyword)) ||- knownModel?.abilities?.vision ||- false,- };- }) as ChatModelCard[];+ return processModelList(modelList, MODEL_LIST_CONFIGS.internlm, 'internlm');},provider: ModelProvider.InternLM,} satisfies OpenAICompatibleFactoryOptions;diff --git a/packages/model-runtime/src/utils/modelParse.ts b/packages/model-runtime/src/utils/modelParse.tsindex 8480f59a552..6e6b4ccb560 100644--- a/packages/model-runtime/src/utils/modelParse.ts+++ b/packages/model-runtime/src/utils/modelParse.ts@@ -56,6 +56,11 @@ export const MODEL_LIST_CONFIGS = {reasoningKeywords: ['ring-'],visionKeywords: ['ming-'],},+ internlm: {+ functionCallKeywords: ['internlm', 'intern-s'],+ reasoningKeywords: ['intern-s'],+ visionKeywords: ['internvl', 'intern-s'],+ },llama: {functionCallKeywords: ['llama-3.2', 'llama-3.3', 'llama-4'],reasoningKeywords: [],@@ -159,6 +164,7 @@ export const MODEL_OWNER_DETECTION_CONFIG = {deepseek: ['deepseek'],google: ['gemini', 'imagen', 'gemma'],inclusionai: ['ling-', 'ming-', 'ring-'],+ internlm: ['internvl', 'internlm', 'intern-'],llama: ['llama', 'llava'],longcat: ['longcat'],minimax: ['minimax'],@@ -664,6 +670,10 @@ export const processModelList = async (return Promise.all(modelList.map(async (model) => {+ if (!model?.id) {+ return undefined;+ }+let knownModel: any = null;// If provider is provided, prioritize using provider-specific configuration