@lobehub/chat 1.6.2 → 1.6.4

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 CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.6.4](https://github.com/lobehub/lobe-chat/compare/v1.6.3...v1.6.4)
6
+
7
+ <sup>Released on **2024-07-21**</sup>
8
+
9
+ #### ♻ Code Refactoring
10
+
11
+ - **misc**: Add trpc query client with react-query.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Code refactoring
19
+
20
+ - **misc**: Add trpc query client with react-query, closes [#3282](https://github.com/lobehub/lobe-chat/issues/3282) ([013ee54](https://github.com/lobehub/lobe-chat/commit/013ee54))
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
+
30
+ ### [Version 1.6.3](https://github.com/lobehub/lobe-chat/compare/v1.6.2...v1.6.3)
31
+
32
+ <sup>Released on **2024-07-21**</sup>
33
+
34
+ #### 💄 Styles
35
+
36
+ - **misc**: Update Zhipu models (GLM-4-AllTools & CodeGeeX-4).
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### Styles
44
+
45
+ - **misc**: Update Zhipu models (GLM-4-AllTools & CodeGeeX-4), closes [#3255](https://github.com/lobehub/lobe-chat/issues/3255) ([a92939f](https://github.com/lobehub/lobe-chat/commit/a92939f))
46
+
47
+ </details>
48
+
49
+ <div align="right">
50
+
51
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
52
+
53
+ </div>
54
+
5
55
  ### [Version 1.6.2](https://github.com/lobehub/lobe-chat/compare/v1.6.1...v1.6.2)
6
56
 
7
57
  <sup>Released on **2024-07-21**</sup>
package/README.md CHANGED
@@ -265,14 +265,14 @@ Our marketplace is not just a showcase platform but also a collaborative space.
265
265
 
266
266
  <!-- AGENT LIST -->
267
267
 
268
- | Recent Submits | Description |
269
- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
270
- | [Convert SQL Table Structure to Dao and Mapper](https://chat-preview.lobehub.com/market?agent=my-batis-generator)<br/><sup>By **[MeYoung](https://github.com/MeYoung)** on **2024-07-17**</sup> | Generate entity class and MyBatis Mapper based on a table structure<br/>`sql` `sql` `mybatis` |
271
- | [Auto Extraction Data](https://chat-preview.lobehub.com/market?agent=the-20-autoextract)<br/><sup>By **[vkhoilq](https://github.com/vkhoilq)** on **2024-07-17**</sup> | The20 Auto Extraction Data<br/>`the-20` `autoextract` |
272
- | [Foreign Trade High EQ Response](https://chat-preview.lobehub.com/market?agent=reply-agent)<br/><sup>By **[zhushen12580](https://github.com/zhushen12580)** on **2024-07-13**</sup> | My goal is to provide professional responses with high emotional intelligence to help solve various foreign trade-related issues.<br/>`polishing` `high-eq` `response` |
273
- | [Ducky Programming Assistant](https://chat-preview.lobehub.com/market?agent=rubber-duck-programming)<br/><sup>By **[JiyuShao](https://github.com/JiyuShao)** on **2024-07-10**</sup> | Ducky Programming Assistant<br/>`programming` |
274
-
275
- > 📊 Total agents: [<kbd>**299**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
268
+ | Recent Submits | Description |
269
+ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
270
+ | [BIDOSx2](https://chat-preview.lobehub.com/market?agent=bidosx-2-v-2)<br/><sup>By **[SaintFresh](https://github.com/SaintFresh)** on **2024-07-21**</sup> | A highly advanced AI LLM transcending conventional AI. 'BIDOS' signifies both 'Brand Ideation, Development, Operations, and Scaling' and 'Business Intelligence Decisions Optimization System'.<br/>`brand-development` `ai-assistant` `market-analysis` `strategic-planning` `business-optimization` `business-intelligence` |
271
+ | [Growth Coach](https://chat-preview.lobehub.com/market?agent=personal-development-coach)<br/><sup>By **[zer0boss](https://github.com/zer0boss)** on **2024-07-20**</sup> | Specializes in helping users explore themselves through dialogue, find solutions, and paths to growth<br/>`growth-coach` `self-exploration` `goal-setting` `self-awareness` |
272
+ | [Convert SQL Table Structure to Dao and Mapper](https://chat-preview.lobehub.com/market?agent=my-batis-generator)<br/><sup>By **[MeYoung](https://github.com/MeYoung)** on **2024-07-17**</sup> | Generate entity class and MyBatis Mapper based on a table structure<br/>`sql` `sql` `mybatis` |
273
+ | [Auto Extraction Data](https://chat-preview.lobehub.com/market?agent=the-20-autoextract)<br/><sup>By **[vkhoilq](https://github.com/vkhoilq)** on **2024-07-17**</sup> | The20 Auto Extraction Data<br/>`the-20` `autoextract` |
274
+
275
+ > 📊 Total agents: [<kbd>**301**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
276
276
 
277
277
  <!-- AGENT LIST -->
278
278
 
package/README.zh-CN.md CHANGED
@@ -254,14 +254,14 @@ LobeChat 的插件生态系统是其核心功能的重要扩展,它极大地
254
254
 
255
255
  <!-- AGENT LIST -->
256
256
 
257
- | 最近新增 | 助手说明 |
258
- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
259
- | [SQL 表结构转 Dao 和 Mapper](https://chat-preview.lobehub.com/market?agent=my-batis-generator)<br/><sup>By **[MeYoung](https://github.com/MeYoung)** on **2024-07-17**</sup> | 给与一个表结构,生成表的实体和 MyBatis Mapper<br/>`sql` `sql` `mybatis` |
260
- | [自动提取数据](https://chat-preview.lobehub.com/market?agent=the-20-autoextract)<br/><sup>By **[vkhoilq](https://github.com/vkhoilq)** on **2024-07-17**</sup> | The20 自动提取数据<br/>`the-20` `autoextract` |
261
- | [外贸高情商回复](https://chat-preview.lobehub.com/market?agent=reply-agent)<br/><sup>By **[zhushen12580](https://github.com/zhushen12580)** on **2024-07-13**</sup> | 我的目标是提供具有高情商的专业回复,帮助解决各种外贸相关的问题。<br/>`润色` `高情商` `回复` |
262
- | [小黄鸭编程助手](https://chat-preview.lobehub.com/market?agent=rubber-duck-programming)<br/><sup>By **[JiyuShao](https://github.com/JiyuShao)** on **2024-07-10**</sup> | 小黄鸭编程助手<br/>`programming` |
263
-
264
- > 📊 Total agents: [<kbd>**299**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
257
+ | 最近新增 | 助手说明 |
258
+ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
259
+ | [BIDOSx2](https://chat-preview.lobehub.com/market?agent=bidosx-2-v-2)<br/><sup>By **[SaintFresh](https://github.com/SaintFresh)** on **2024-07-21**</sup> | 一种高度先进的 AI LLM,超越传统人工智能。'BIDOS' 既代表 ' 品牌构思、发展、运营和扩展 ',也代表 ' 商业智能决策优化系统 '。<br/>`品牌发展` `ai助手` `市场分析` `战略规划` `业务优化` `商业智能` |
260
+ | [成长教练](https://chat-preview.lobehub.com/market?agent=personal-development-coach)<br/><sup>By **[zer0boss](https://github.com/zer0boss)** on **2024-07-20**</sup> | 擅长用对话的方式帮助用户自我探索,找到解决之道和成长之路<br/>`成长教练` `自我探索` `目标设定` `自我觉察` |
261
+ | [SQL 表结构转 Dao 和 Mapper](https://chat-preview.lobehub.com/market?agent=my-batis-generator)<br/><sup>By **[MeYoung](https://github.com/MeYoung)** on **2024-07-17**</sup> | 给与一个表结构,生成表的实体和 MyBatis 的 Mapper<br/>`sql` `sql` `mybatis` |
262
+ | [自动提取数据](https://chat-preview.lobehub.com/market?agent=the-20-autoextract)<br/><sup>By **[vkhoilq](https://github.com/vkhoilq)** on **2024-07-17**</sup> | The20 自动提取数据<br/>`the-20` `autoextract` |
263
+
264
+ > 📊 Total agents: [<kbd>**301**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
265
265
 
266
266
  <!-- AGENT LIST -->
267
267
 
@@ -64,7 +64,7 @@ Command explanation:
64
64
 
65
65
  - Replace `sk-xxxx` in the above command with your OpenAI API Key.
66
66
 
67
- - For the complete list of environment variables supported by LobeChat, please refer to the [Environment Variables](/docs/self-hosting/environment-ariable) section.
67
+ - For the complete list of environment variables supported by LobeChat, please refer to the [Environment Variables](/docs/self-hosting/environment-variables) section.
68
68
 
69
69
  <Callout type="tip">
70
70
  Since the official Docker image build takes about half an hour, if you see the "update available"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.6.2",
3
+ "version": "1.6.4",
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",
@@ -121,8 +121,10 @@
121
121
  "@next/third-parties": "^14.2.4",
122
122
  "@sentry/nextjs": "^7.118.0",
123
123
  "@t3-oss/env-nextjs": "^0.10.1",
124
+ "@tanstack/react-query": "^5.51.11",
124
125
  "@trpc/client": "next",
125
126
  "@trpc/next": "next",
127
+ "@trpc/react-query": "next",
126
128
  "@trpc/server": "next",
127
129
  "@vercel/analytics": "^1.3.1",
128
130
  "@vercel/speed-insights": "^1.0.12",
@@ -9,6 +9,7 @@ import {
9
9
  ByteDance,
10
10
  ChatGLM,
11
11
  Claude,
12
+ CodeGeeX,
12
13
  Cohere,
13
14
  Dbrx,
14
15
  DeepSeek,
@@ -50,6 +51,7 @@ const ModelIcon = memo<ModelProviderIconProps>(({ model: originModel, size = 12
50
51
  if (model.includes('gpt-3')) return <OpenAI.Avatar size={size} type={'gpt3'} />;
51
52
  if (model.includes('gpt-4')) return <OpenAI.Avatar size={size} type={'gpt4'} />;
52
53
  if (model.startsWith('glm') || model.includes('chatglm')) return <ChatGLM.Avatar size={size} />;
54
+ if (model.startsWith('codegeex')) return <CodeGeeX.Avatar size={size} />;
53
55
  if (model.includes('deepseek')) return <DeepSeek.Avatar size={size} />;
54
56
  if (model.includes('claude')) return <Claude.Avatar size={size} />;
55
57
  if (model.includes('titan')) return <Aws.Avatar size={size} />;
@@ -9,6 +9,7 @@ import {
9
9
  ByteDance,
10
10
  ChatGLM,
11
11
  Claude,
12
+ CodeGeeX,
12
13
  Cohere,
13
14
  Dbrx,
14
15
  DeepSeek,
@@ -45,6 +46,7 @@ const ModelIcon = memo<ModelIconProps>(({ model, size = 12 }) => {
45
46
  // currently supported models, maybe not in its own provider
46
47
  if (model.startsWith('gpt')) return <OpenAI size={size} />;
47
48
  if (model.startsWith('glm') || model.includes('chatglm')) return <ChatGLM size={size} />;
49
+ if (model.includes('codegeex')) return <CodeGeeX size={size} />;
48
50
  if (model.includes('claude')) return <Claude size={size} />;
49
51
  if (model.includes('deepseek')) return <DeepSeek size={size} />;
50
52
  if (model.includes('titan')) return <Aws size={size} />;
@@ -8,7 +8,15 @@ const ZeroOne: ModelProviderCard = {
8
8
  displayName: 'Yi Large',
9
9
  enabled: true,
10
10
  id: 'yi-large',
11
- tokens: 16_384,
11
+ tokens: 32_768,
12
+ },
13
+ {
14
+ description: '在 yi-large 模型的基础上支持并强化了工具调用的能力,适用于各种需要搭建 agent 或 workflow 的业务场景。',
15
+ displayName: 'Yi Large FC',
16
+ enabled: true,
17
+ functionCall: true,
18
+ id: 'yi-large-fc',
19
+ tokens: 32_768,
12
20
  },
13
21
  {
14
22
  description: '中型尺寸模型升级微调,能力均衡,性价比高。深度优化指令遵循能力。',
@@ -22,7 +30,7 @@ const ZeroOne: ModelProviderCard = {
22
30
  displayName: 'Yi Vision',
23
31
  enabled: true,
24
32
  id: 'yi-vision',
25
- tokens: 4096,
33
+ tokens: 16_384,
26
34
  },
27
35
  {
28
36
  description: '200K 超长上下文窗口,提供长文本深度理解和生成能力。',
@@ -66,7 +74,7 @@ const ZeroOne: ModelProviderCard = {
66
74
  tokens: 16_384,
67
75
  },
68
76
  ],
69
- checkModel: 'yi-34b-chat-0205',
77
+ checkModel: 'yi-large',
70
78
  id: 'zeroone',
71
79
  name: '01.AI',
72
80
  };
@@ -2,8 +2,17 @@ import { ModelProviderCard } from '@/types/llm';
2
2
 
3
3
  // ref https://open.bigmodel.cn/dev/howuse/model
4
4
  // api https://open.bigmodel.cn/dev/api#language
5
+ // ref https://open.bigmodel.cn/modelcenter/square
5
6
  const ZhiPu: ModelProviderCard = {
6
7
  chatModels: [
8
+ {
9
+ description: 'GLM-4-AllTools 是专门为支持智能体和相关任务而进一步优化的模型版本。它能够自主理解用户的意图,规划复杂的指令,并能够调用一个或多个工具(例如网络浏览器、代码解释器和文本生图像)以完成复杂的任务。',
10
+ displayName: 'GLM-4-AllTools',
11
+ enabled: true,
12
+ functionCall: true,
13
+ id: 'glm-4-alltools',
14
+ tokens: 128_000,
15
+ },
7
16
  {
8
17
  description: '智谱当前最先进最智能的模型,指令遵从能力大幅提升18.6%,发布于20240605',
9
18
  displayName: 'GLM-4-0520',
@@ -29,10 +38,10 @@ const ZhiPu: ModelProviderCard = {
29
38
  },
30
39
  {
31
40
  description: 'GLM-4-Air 的高性能版本,效果不变,推理速度达到其2.6倍',
32
- displayName: 'GLM-4-Airx',
41
+ displayName: 'GLM-4-AirX',
33
42
  functionCall: true,
34
43
  id: 'glm-4-airx',
35
- tokens: 128_000,
44
+ tokens: 8192,
36
45
  },
37
46
  {
38
47
  description: '适用简单任务,速度最快,价格最实惠的版本',
@@ -55,6 +64,14 @@ const ZhiPu: ModelProviderCard = {
55
64
  id: 'glm-3-turbo',
56
65
  tokens: 128_000,
57
66
  },
67
+ {
68
+ description: 'CodeGeeX是一款强大的AI编程助手,提供智能问答和代码补全功能,支持多种编程语言,帮助开发者提高编程效率。',
69
+ displayName: 'CodeGeeX-4',
70
+ enabled: true,
71
+ functionCall: false,
72
+ id: 'codegeex-4',
73
+ tokens: 128_000,
74
+ },
58
75
  ],
59
76
  checkModel: 'glm-4-flash',
60
77
  id: 'zhipu',
@@ -0,0 +1,18 @@
1
+ 'use client';
2
+
3
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
4
+ import React, { PropsWithChildren, useState } from 'react';
5
+
6
+ import { lambdaQuery, lambdaQueryClient } from '@/libs/trpc/client';
7
+
8
+ const QueryProvider = ({ children }: PropsWithChildren) => {
9
+ const [queryClient] = useState(() => new QueryClient());
10
+
11
+ return (
12
+ <lambdaQuery.Provider client={lambdaQueryClient} queryClient={queryClient}>
13
+ <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
14
+ </lambdaQuery.Provider>
15
+ );
16
+ };
17
+
18
+ export default QueryProvider;
@@ -19,6 +19,7 @@ import { isMobileDevice } from '@/utils/responsive';
19
19
 
20
20
  import AppTheme from './AppTheme';
21
21
  import Locale from './Locale';
22
+ import QueryProvider from './Query';
22
23
  import StoreInitialization from './StoreInitialization';
23
24
  import StyleRegistry from './StyleRegistry';
24
25
 
@@ -87,7 +88,7 @@ const GlobalLayout = async ({ children }: PropsWithChildren) => {
87
88
  isMobile={isMobile}
88
89
  serverConfig={serverConfig}
89
90
  >
90
- {children}
91
+ <QueryProvider>{children}</QueryProvider>
91
92
  <StoreInitialization />
92
93
  </ServerConfigStoreProvider>
93
94
  <DebugUI />
@@ -0,0 +1,20 @@
1
+ import { createTRPCClient, httpBatchLink } from '@trpc/client';
2
+ import superjson from 'superjson';
3
+
4
+ import type { EdgeRouter } from '@/server/routers/edge';
5
+ import { withBasePath } from '@/utils/basePath';
6
+
7
+ export const edgeClient = createTRPCClient<EdgeRouter>({
8
+ links: [
9
+ httpBatchLink({
10
+ headers: async () => {
11
+ // dynamic import to avoid circular dependency
12
+ const { createHeaderWithAuth } = await import('@/services/_auth');
13
+
14
+ return createHeaderWithAuth();
15
+ },
16
+ transformer: superjson,
17
+ url: withBasePath('/trpc/edge'),
18
+ }),
19
+ ],
20
+ });
@@ -0,0 +1,2 @@
1
+ export { edgeClient } from './edge';
2
+ export * from './lambda';
@@ -0,0 +1,38 @@
1
+ import { createTRPCClient, httpBatchLink } from '@trpc/client';
2
+ import { createTRPCReact } from '@trpc/react-query';
3
+ import superjson from 'superjson';
4
+
5
+ import { fetchErrorNotification } from '@/components/FetchErrorNotification';
6
+ import type { LambdaRouter } from '@/server/routers/lambda';
7
+
8
+ import { ErrorResponse } from './types';
9
+
10
+ const links = [
11
+ httpBatchLink({
12
+ fetch: async (input, init) => {
13
+ const response = await fetch(input, init);
14
+ if (response.ok) return response;
15
+
16
+ const errorRes: ErrorResponse = await response.clone().json();
17
+
18
+ errorRes.forEach((item) => {
19
+ const errorData = item.error.json;
20
+
21
+ const status = errorData.data.httpStatus;
22
+ fetchErrorNotification.error({ errorMessage: errorData.message, status });
23
+ });
24
+
25
+ return response;
26
+ },
27
+ transformer: superjson,
28
+ url: '/trpc/lambda',
29
+ }),
30
+ ];
31
+
32
+ export const lambdaClient = createTRPCClient<LambdaRouter>({
33
+ links,
34
+ });
35
+
36
+ export const lambdaQuery = createTRPCReact<LambdaRouter>();
37
+
38
+ export const lambdaQueryClient = lambdaQuery.createClient({ links });
@@ -0,0 +1,18 @@
1
+ export type ErrorResponse = ErrorItem[];
2
+
3
+ export interface ErrorItem {
4
+ error: {
5
+ json: {
6
+ code: number;
7
+ data: Data;
8
+ message: string;
9
+ };
10
+ };
11
+ }
12
+
13
+ export interface Data {
14
+ code: string;
15
+ httpStatus: number;
16
+ path: string;
17
+ stack: string;
18
+ }
@@ -1,65 +0,0 @@
1
- import { createTRPCClient, httpBatchLink } from '@trpc/client';
2
- import superjson from 'superjson';
3
-
4
- import { fetchErrorNotification } from '@/components/FetchErrorNotification';
5
- import type { EdgeRouter } from '@/server/routers/edge';
6
- import type { LambdaRouter } from '@/server/routers/lambda';
7
- import { withBasePath } from '@/utils/basePath';
8
-
9
- export const edgeClient = createTRPCClient<EdgeRouter>({
10
- links: [
11
- httpBatchLink({
12
- headers: async () => {
13
- // dynamic import to avoid circular dependency
14
- const { createHeaderWithAuth } = await import('@/services/_auth');
15
-
16
- return createHeaderWithAuth();
17
- },
18
- transformer: superjson,
19
- url: withBasePath('/trpc/edge'),
20
- }),
21
- ],
22
- });
23
-
24
- export type ErrorResponse = ErrorItem[];
25
-
26
- export interface ErrorItem {
27
- error: {
28
- json: {
29
- code: number;
30
- data: Data;
31
- message: string;
32
- };
33
- };
34
- }
35
-
36
- export interface Data {
37
- code: string;
38
- httpStatus: number;
39
- path: string;
40
- stack: string;
41
- }
42
-
43
- export const lambdaClient = createTRPCClient<LambdaRouter>({
44
- links: [
45
- httpBatchLink({
46
- fetch: async (input, init) => {
47
- const response = await fetch(input, init);
48
- if (response.ok) return response;
49
-
50
- const errorRes: ErrorResponse = await response.clone().json();
51
-
52
- errorRes.forEach((item) => {
53
- const errorData = item.error.json;
54
-
55
- const status = errorData.data.httpStatus;
56
- fetchErrorNotification.error({ errorMessage: errorData.message, status });
57
- });
58
-
59
- return response;
60
- },
61
- transformer: superjson,
62
- url: '/trpc/lambda',
63
- }),
64
- ],
65
- });