@lobehub/chat 1.117.1 → 1.118.0

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/AGENTS.md ADDED
@@ -0,0 +1,133 @@
1
+ # LobeChat Development Guidelines
2
+
3
+ This document serves as a comprehensive guide for all team members when developing LobeChat.
4
+
5
+ ## Tech Stack
6
+
7
+ Built with modern technologies:
8
+
9
+ - **Frontend**: Next.js 15, React 19, TypeScript
10
+ - **UI Components**: Ant Design, @lobehub/ui, antd-style
11
+ - **State Management**: Zustand, SWR
12
+ - **Database**: PostgreSQL, PGLite, Drizzle ORM
13
+ - **Testing**: Vitest, Testing Library
14
+ - **Package Manager**: pnpm (monorepo structure)
15
+ - **Build Tools**: Next.js (Turbopack in dev, Webpack in prod), Vitest
16
+
17
+ ## Directory Structure
18
+
19
+ The project follows a well-organized monorepo structure:
20
+
21
+ - `apps/` - Main applications
22
+ - `packages/` - Shared packages and libraries
23
+ - `src/` - Main source code
24
+ - `docs/` - Documentation
25
+ - `.cursor/rules/` - Development rules and guidelines
26
+
27
+ ## Development Workflow
28
+
29
+ ### Git Workflow
30
+
31
+ - Use rebase for git pull: `git pull --rebase`
32
+ - Git commit messages should prefix with gitmoji
33
+ - Git branch name format: `username/feat/feature-name`
34
+ - Use `.github/PULL_REQUEST_TEMPLATE.md` for PR descriptions
35
+
36
+ ### Package Management
37
+
38
+ - Use `pnpm` as the primary package manager
39
+ - Use `bun` to run npm scripts
40
+ - Use `bunx` to run executable npm packages
41
+ - Navigate to specific packages using `cd packages/<package-name>`
42
+
43
+ ### Code Style Guidelines
44
+
45
+ #### TypeScript
46
+
47
+ - Follow strict TypeScript practices for type safety and code quality
48
+ - Use proper type annotations
49
+ - Prefer interfaces over types for object shapes
50
+ - Use generics for reusable components
51
+
52
+ #### React Components
53
+
54
+ - Use functional components with hooks
55
+ - Follow the component structure guidelines
56
+ - Use antd-style & @lobehub/ui for styling
57
+ - Implement proper error boundaries
58
+
59
+ #### Database Schema
60
+
61
+ - Follow Drizzle ORM naming conventions
62
+ - Use plural snake_case for table names
63
+ - Implement proper foreign key relationships
64
+ - Follow the schema style guide
65
+
66
+ ### Testing Strategy
67
+
68
+ **Required Rule**: `testing-guide/testing-guide.mdc`
69
+
70
+ **Commands**:
71
+
72
+ - Web: `bunx vitest run --silent='passed-only' '[file-path-pattern]'`
73
+ - Packages: `cd packages/[package-name] && bunx vitest run --silent='passed-only' '[file-path-pattern]'`
74
+
75
+ **Important Notes**:
76
+
77
+ - Wrap file paths in single quotes to avoid shell expansion
78
+ - Never run `bun run test` - this runs all tests and takes ~10 minutes
79
+ - If a test fails twice, stop and ask for help
80
+ - Always add tests for new code
81
+
82
+ ### Type Checking
83
+
84
+ - Use `bun run type-check` to check for type errors
85
+ - Ensure all TypeScript errors are resolved before committing
86
+
87
+ ### Internationalization
88
+
89
+ - Add new keys to `src/locales/default/namespace.ts`
90
+ - Translate at least `zh-CN` files for development preview
91
+ - Use hierarchical nested objects, not flat keys
92
+ - Don't run `pnpm i18n` manually (handled by CI)
93
+
94
+ ## Available Development Rules
95
+
96
+ The project provides comprehensive rules in `.cursor/rules/` directory:
97
+
98
+ ### Core Development
99
+
100
+ - `backend-architecture.mdc` - Three-layer architecture and data flow
101
+ - `react-component.mdc` - Component patterns and UI library usage
102
+ - `drizzle-schema-style-guide.mdc` - Database schema conventions
103
+ - `define-database-model.mdc` - Model templates and CRUD patterns
104
+ - `i18n.mdc` - Internationalization workflow
105
+
106
+ ### State Management & UI
107
+
108
+ - `zustand-slice-organization.mdc` - Store organization patterns
109
+ - `zustand-action-patterns.mdc` - Action implementation patterns
110
+ - `packages/react-layout-kit.mdc` - Flex layout component usage
111
+
112
+ ### Testing & Quality
113
+
114
+ - `testing-guide/testing-guide.mdc` - Comprehensive testing strategy
115
+ - `code-review.mdc` - Code review process and standards
116
+
117
+ ### Desktop (Electron)
118
+
119
+ - `desktop-feature-implementation.mdc` - Main/renderer process patterns
120
+ - `desktop-local-tools-implement.mdc` - Tool integration workflow
121
+ - `desktop-menu-configuration.mdc` - Menu system configuration
122
+ - `desktop-window-management.mdc` - Window management patterns
123
+ - `desktop-controller-tests.mdc` - Controller testing guide
124
+
125
+ ## Best Practices
126
+
127
+ - **Conservative for existing code, modern approaches for new features**
128
+ - **Code Language**: Use Chinese for files with existing Chinese comments, American English for new files
129
+ - Always add tests for new functionality
130
+ - Follow the established patterns in the codebase
131
+ - Use proper error handling and logging
132
+ - Implement proper accessibility features
133
+ - Consider internationalization from the start
package/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ## [Version 1.118.0](https://github.com/lobehub/lobe-chat/compare/v1.117.1...v1.118.0)
6
+
7
+ <sup>Released on **2025-08-29**</sup>
8
+
9
+ #### ✨ Features
10
+
11
+ - **misc**: Add new provider AkashChat.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's improved
19
+
20
+ - **misc**: Add new provider AkashChat, closes [#8923](https://github.com/lobehub/lobe-chat/issues/8923) ([2f3bf0f](https://github.com/lobehub/lobe-chat/commit/2f3bf0f))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
5
30
  ### [Version 1.117.1](https://github.com/lobehub/lobe-chat/compare/v1.117.0...v1.117.1)
6
31
 
7
32
  <sup>Released on **2025-08-29**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,13 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "features": [
5
+ "Add new provider AkashChat."
6
+ ]
7
+ },
8
+ "date": "2025-08-29",
9
+ "version": "1.118.0"
10
+ },
2
11
  {
3
12
  "children": {
4
13
  "improvements": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.117.1",
3
+ "version": "1.118.0",
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",
@@ -0,0 +1,43 @@
1
+ import { ModelProvider } from '../types';
2
+ import { processMultiProviderModelList } from '../utils/modelParse';
3
+ import { createOpenAICompatibleRuntime } from '../utils/openaiCompatibleFactory';
4
+
5
+ export interface AkashChatModelCard {
6
+ id: string;
7
+ }
8
+
9
+ export const LobeAkashChatAI = createOpenAICompatibleRuntime({
10
+ baseURL: 'https://chatapi.akash.network/api/v1',
11
+ chatCompletion: {
12
+ handlePayload: (payload) => {
13
+ const { model, ...rest } = payload;
14
+
15
+ return {
16
+ ...rest,
17
+ model,
18
+ stream: true,
19
+ } as any;
20
+ },
21
+ },
22
+ debug: {
23
+ chatCompletion: () => process.env.DEBUG_AKASH_CHAT_COMPLETION === '1',
24
+ },
25
+ models: async ({ client }) => {
26
+ try {
27
+ const modelsPage = (await client.models.list()) as any;
28
+ const rawList: any[] = modelsPage.data || [];
29
+
30
+ // Remove `created` field from each model item
31
+ const modelList: AkashChatModelCard[] = rawList.map(({ created, ...rest }) => rest);
32
+
33
+ return await processMultiProviderModelList(modelList, 'akashchat');
34
+ } catch (error) {
35
+ console.warn(
36
+ 'Failed to fetch AkashChat models. Please ensure your AkashChat API key is valid:',
37
+ error,
38
+ );
39
+ return [];
40
+ }
41
+ },
42
+ provider: ModelProvider.AkashChat,
43
+ });
@@ -1,3 +1,4 @@
1
+ export { LobeAkashChatAI } from './akashchat';
1
2
  export { LobeAnthropicAI } from './anthropic';
2
3
  export { LobeAzureAI } from './azureai';
3
4
  export { LobeAzureOpenAI } from './azureOpenai';
@@ -366,7 +366,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
366
366
  "maxOutput": undefined,
367
367
  "reasoning": false,
368
368
  "releasedAt": "2022-12-16",
369
- "type": "chat",
369
+ "type": "embedding",
370
370
  "vision": false,
371
371
  },
372
372
  {
@@ -2,6 +2,7 @@ import { LobeAi21AI } from './ai21';
2
2
  import { Lobe302AI } from './ai302';
3
3
  import { LobeAi360AI } from './ai360';
4
4
  import { LobeAiHubMixAI } from './aihubmix';
5
+ import { LobeAkashChatAI } from './akashchat';
5
6
  import { LobeAnthropicAI } from './anthropic';
6
7
  import { LobeAzureOpenAI } from './azureOpenai';
7
8
  import { LobeAzureAI } from './azureai';
@@ -61,6 +62,7 @@ export const providerRuntimeMap = {
61
62
  ai302: Lobe302AI,
62
63
  ai360: LobeAi360AI,
63
64
  aihubmix: LobeAiHubMixAI,
65
+ akashchat: LobeAkashChatAI,
64
66
  anthropic: LobeAnthropicAI,
65
67
  azure: LobeAzureOpenAI,
66
68
  azureai: LobeAzureAI,
@@ -32,6 +32,7 @@ export enum ModelProvider {
32
32
  Ai302 = 'ai302',
33
33
  Ai360 = 'ai360',
34
34
  AiHubMix = 'aihubmix',
35
+ AkashChat = 'akashchat',
35
36
  Anthropic = 'anthropic',
36
37
  Azure = 'azure',
37
38
  AzureAI = 'azureai',
@@ -118,6 +118,14 @@ export const IMAGE_MODEL_KEYWORDS = [
118
118
  '^V_1',
119
119
  ] as const;
120
120
 
121
+ // 嵌入模型关键词配置
122
+ export const EMBEDDING_MODEL_KEYWORDS = [
123
+ 'embedding',
124
+ 'embed',
125
+ 'bge',
126
+ 'm3e',
127
+ ] as const;
128
+
121
129
  /**
122
130
  * 检测关键词列表是否匹配模型ID(支持多种匹配模式)
123
131
  * @param modelId 模型ID(小写)
@@ -278,7 +286,12 @@ const processModelCard = (
278
286
  IMAGE_MODEL_KEYWORDS.map((k) => k.toLowerCase()),
279
287
  )
280
288
  ? 'image'
281
- : 'chat');
289
+ : isKeywordListMatch(
290
+ model.id.toLowerCase(),
291
+ EMBEDDING_MODEL_KEYWORDS.map((k) => k.toLowerCase()),
292
+ )
293
+ ? 'embedding'
294
+ : 'chat');
282
295
 
283
296
  // image model can't find parameters
284
297
  if (modelType === 'image' && !model.parameters && !knownModel?.parameters) {
@@ -41,6 +41,7 @@ export interface UserKeyVaults extends SearchEngineKeyVaults {
41
41
  ai302?: OpenAICompatibleKeyVault;
42
42
  ai360?: OpenAICompatibleKeyVault;
43
43
  aihubmix?: OpenAICompatibleKeyVault;
44
+ akashchat?: OpenAICompatibleKeyVault;
44
45
  anthropic?: OpenAICompatibleKeyVault;
45
46
  azure?: AzureOpenAIKeyVault;
46
47
  azureai?: AzureOpenAIKeyVault;
@@ -4,6 +4,7 @@ import {
4
4
  Ai21ProviderCard,
5
5
  Ai302ProviderCard,
6
6
  Ai360ProviderCard,
7
+ AkashChatProviderCard,
7
8
  AnthropicProviderCard,
8
9
  BaichuanProviderCard,
9
10
  CohereProviderCard,
@@ -113,6 +114,7 @@ export const useProviderList = (): ProviderItem[] => {
113
114
  GiteeAIProviderCard,
114
115
  PPIOProviderCard,
115
116
  InfiniAIProviderCard,
117
+ AkashChatProviderCard,
116
118
  Ai302ProviderCard,
117
119
  ],
118
120
  [
@@ -0,0 +1,84 @@
1
+ import { AIChatModelCard } from '@/types/aiModel';
2
+
3
+ const akashChatModels: AIChatModelCard[] = [
4
+ {
5
+ abilities: {
6
+ functionCall: true,
7
+ reasoning: true,
8
+ },
9
+ contextWindowTokens: 65_536,
10
+ description:
11
+ 'DeepSeek V3.1:下一代推理模型,提升了复杂推理与链路思考能力,适合需要深入分析的任务。',
12
+ displayName: 'DeepSeek V3.1',
13
+ enabled: true,
14
+ id: 'DeepSeek-V3-1',
15
+ type: 'chat',
16
+ },
17
+ {
18
+ abilities: {
19
+ functionCall: true,
20
+ reasoning: true,
21
+ },
22
+ contextWindowTokens: 65_536,
23
+ displayName: 'DeepSeek R1 Distill Qwen 32B',
24
+ id: 'DeepSeek-R1-Distill-Qwen-32B',
25
+ type: 'chat',
26
+ },
27
+ {
28
+ abilities: {
29
+ functionCall: true,
30
+ reasoning: true,
31
+ },
32
+ contextWindowTokens: 131_072,
33
+ description: 'GPT-OSS-120B MXFP4 量化的 Transformer 结构,在资源受限时仍能保持强劲性能。',
34
+ displayName: 'GPT-OSS-120B',
35
+ enabled: true,
36
+ id: 'gpt-oss-120b',
37
+ type: 'chat',
38
+ },
39
+ {
40
+ abilities: {
41
+ functionCall: true,
42
+ },
43
+ contextWindowTokens: 262_144,
44
+ description:
45
+ 'Qwen3 235B A22B Instruct 2507:面向高级推理与对话指令优化的模型,混合专家架构以在大规模参数下保持推理效率。',
46
+ displayName: 'Qwen3 235B A22B Instruct 2507',
47
+ id: 'Qwen3-235B-A22B-Instruct-2507-FP8',
48
+ type: 'chat',
49
+ },
50
+ {
51
+ abilities: {
52
+ functionCall: true,
53
+ vision: true,
54
+ },
55
+ contextWindowTokens: 131_072,
56
+ description:
57
+ 'Llama 4 Maverick:基于 Mixture-of-Experts 的大规模模型,提供高效的专家激活策略以在推理中表现优异。',
58
+ displayName: 'Llama 4 Maverick (17Bx128E)',
59
+ id: 'Meta-Llama-4-Maverick-17B-128E-Instruct-FP8',
60
+ type: 'chat',
61
+ },
62
+ {
63
+ abilities: {
64
+ functionCall: true,
65
+ },
66
+ contextWindowTokens: 131_072,
67
+ description: 'Llama 3.3 70B:通用性强的 Transformer 模型,适用于对话和生成任务。',
68
+ displayName: 'Llama 3.3 70B',
69
+ id: 'Meta-Llama-3-3-70B-Instruct',
70
+ type: 'chat',
71
+ },
72
+ {
73
+ abilities: {
74
+ functionCall: true,
75
+ },
76
+ contextWindowTokens: 131_072,
77
+ displayName: 'Llama 3.1 8B',
78
+ id: 'Meta-Llama-3-1-8B-Instruct-FP8',
79
+ type: 'chat',
80
+ },
81
+ ];
82
+ export const allModels = [...akashChatModels];
83
+
84
+ export default allModels;
@@ -4,6 +4,7 @@ import { default as ai21 } from './ai21';
4
4
  import { default as ai302 } from './ai302';
5
5
  import { default as ai360 } from './ai360';
6
6
  import { default as aihubmix } from './aihubmix';
7
+ import { default as akashchat } from './akashchat';
7
8
  import { default as anthropic } from './anthropic';
8
9
  import { default as azure } from './azure';
9
10
  import { default as azureai } from './azureai';
@@ -83,6 +84,7 @@ export const LOBE_DEFAULT_MODEL_LIST = buildDefaultModelList({
83
84
  ai302,
84
85
  ai360,
85
86
  aihubmix,
87
+ akashchat,
86
88
  anthropic,
87
89
  azure,
88
90
  azureai,
@@ -143,6 +145,7 @@ export { default as ai21 } from './ai21';
143
145
  export { default as ai302 } from './ai302';
144
146
  export { default as ai360 } from './ai360';
145
147
  export { default as aihubmix } from './aihubmix';
148
+ export { default as akashchat } from './akashchat';
146
149
  export { default as anthropic } from './anthropic';
147
150
  export { default as azure } from './azure';
148
151
  export { default as azureai } from './azureai';
package/src/config/llm.ts CHANGED
@@ -178,6 +178,9 @@ export const getLLMConfig = () => {
178
178
  ENABLED_AI302: z.boolean(),
179
179
  AI302_API_KEY: z.string().optional(),
180
180
 
181
+ ENABLED_AKASHCHAT: z.boolean(),
182
+ AKASHCHAT_API_KEY: z.string().optional(),
183
+
181
184
  ENABLED_AIHUBMIX: z.boolean(),
182
185
  AIHUBMIX_API_KEY: z.string().optional(),
183
186
  },
@@ -356,6 +359,9 @@ export const getLLMConfig = () => {
356
359
  ENABLED_AI302: !!process.env.AI302_API_KEY,
357
360
  AI302_API_KEY: process.env.AI302_API_KEY,
358
361
 
362
+ ENABLED_AKASHCHAT: !!process.env.AKASHCHAT_API_KEY,
363
+ AKASHCHAT_API_KEY: process.env.AKASHCHAT_API_KEY,
364
+
359
365
  ENABLED_AIHUBMIX: !!process.env.AIHUBMIX_API_KEY,
360
366
  AIHUBMIX_API_KEY: process.env.AIHUBMIX_API_KEY,
361
367
  },
@@ -0,0 +1,17 @@
1
+ import { ModelProviderCard } from '@/types/llm';
2
+
3
+ const AkashChat: ModelProviderCard = {
4
+ chatModels: [],
5
+ checkModel: 'Meta-Llama-3-1-8B-Instruct-FP8',
6
+ description: 'Akash 是一个无需许可的云资源市场,与传统云提供商相比,其定价具有竞争力。',
7
+ id: 'akashchat',
8
+ modelsUrl: 'https://chatapi.akash.network/documentation',
9
+ name: 'AkashChat',
10
+ settings: {
11
+ sdkType: 'openai',
12
+ showModelFetcher: true,
13
+ },
14
+ url: 'https://chatapi.akash.network/',
15
+ };
16
+
17
+ export default AkashChat;
@@ -4,6 +4,7 @@ import Ai21Provider from './ai21';
4
4
  import Ai302Provider from './ai302';
5
5
  import Ai360Provider from './ai360';
6
6
  import AiHubMixProvider from './aihubmix';
7
+ import AkashChatProvider from './akashchat';
7
8
  import AnthropicProvider from './anthropic';
8
9
  import AzureProvider from './azure';
9
10
  import AzureAIProvider from './azureai';
@@ -172,6 +173,7 @@ export const DEFAULT_MODEL_PROVIDER_LIST = [
172
173
  Ai360Provider,
173
174
  Search1APIProvider,
174
175
  InfiniAIProvider,
176
+ AkashChatProvider,
175
177
  QiniuProvider,
176
178
  ];
177
179
 
@@ -188,6 +190,7 @@ export { default as Ai21ProviderCard } from './ai21';
188
190
  export { default as Ai302ProviderCard } from './ai302';
189
191
  export { default as Ai360ProviderCard } from './ai360';
190
192
  export { default as AiHubMixProviderCard } from './aihubmix';
193
+ export { default as AkashChatProviderCard } from './akashchat';
191
194
  export { default as AnthropicProviderCard } from './anthropic';
192
195
  export { default as AzureProviderCard } from './azure';
193
196
  export { default as AzureAIProviderCard } from './azureai';