@lobehub/chat 1.21.6 → 1.21.8

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,64 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.21.8](https://github.com/lobehub/lobe-chat/compare/v1.21.7...v1.21.8)
6
+
7
+ <sup>Released on **2024-10-08**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Fix auto rewrite query when user message is too long.
12
+
13
+ #### 💄 Styles
14
+
15
+ - **misc**: Support yml in file chunk.
16
+
17
+ <br/>
18
+
19
+ <details>
20
+ <summary><kbd>Improvements and Fixes</kbd></summary>
21
+
22
+ #### What's fixed
23
+
24
+ - **misc**: Fix auto rewrite query when user message is too long, closes [#4288](https://github.com/lobehub/lobe-chat/issues/4288) ([a2d3d32](https://github.com/lobehub/lobe-chat/commit/a2d3d32))
25
+
26
+ #### Styles
27
+
28
+ - **misc**: Support yml in file chunk, closes [#4283](https://github.com/lobehub/lobe-chat/issues/4283) ([cec7ec0](https://github.com/lobehub/lobe-chat/commit/cec7ec0))
29
+
30
+ </details>
31
+
32
+ <div align="right">
33
+
34
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
35
+
36
+ </div>
37
+
38
+ ### [Version 1.21.7](https://github.com/lobehub/lobe-chat/compare/v1.21.6...v1.21.7)
39
+
40
+ <sup>Released on **2024-10-08**</sup>
41
+
42
+ #### ♻ Code Refactoring
43
+
44
+ - **misc**: Refactor `text-to-image` endpoint.
45
+
46
+ <br/>
47
+
48
+ <details>
49
+ <summary><kbd>Improvements and Fixes</kbd></summary>
50
+
51
+ #### Code refactoring
52
+
53
+ - **misc**: Refactor `text-to-image` endpoint, closes [#4272](https://github.com/lobehub/lobe-chat/issues/4272) ([0c02073](https://github.com/lobehub/lobe-chat/commit/0c02073))
54
+
55
+ </details>
56
+
57
+ <div align="right">
58
+
59
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
60
+
61
+ </div>
62
+
5
63
  ### [Version 1.21.6](https://github.com/lobehub/lobe-chat/compare/v1.21.5...v1.21.6)
6
64
 
7
65
  <sup>Released on **2024-10-05**</sup>
package/README.md CHANGED
@@ -287,12 +287,12 @@ Our marketplace is not just a showcase platform but also a collaborative space.
287
287
 
288
288
  | Recent Submits | Description |
289
289
  | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
290
+ | [A More Diligent Assistant](https://chat-preview.lobehub.com/market?agent=web-development)<br/><sup>By **[fasdfsdf-alt](https://github.com/fasdfsdf-alt)** on **2024-10-02**</sup> | A More Diligent Assistant<br/>`learning` |
290
291
  | [C++/Qt](https://chat-preview.lobehub.com/market?agent=qt-c)<br/><sup>By **[liangyuR](https://github.com/liangyuR)** on **2024-09-30**</sup> | Excels in teaching C++/Qt coding practices<br/>`c` `qt` |
291
292
  | [Birthday Invitation Messages](https://chat-preview.lobehub.com/market?agent=birthday-invitation-message)<br/><sup>By **[tcmonster](https://github.com/tcmonster)** on **2024-09-29**</sup> | Specializes in crafting engaging and personalized Birthday Invitation messages, catering to various themes and tones.<br/>`message-composition` `personalization` `tone-versatility` `event-detail-integration` `interaction-approach` |
292
293
  | [Death Anniversary Messages](https://chat-preview.lobehub.com/market?agent=death-anniversary-message)<br/><sup>By **[tcmonster](https://github.com/tcmonster)** on **2024-09-29**</sup> | Specializes in crafting sensitive and heartfelt Death Anniversary messages with compassion and empathy.<br/>`condolences` `message-composition` `grief-support` `cultural-awareness` `emotional-sensitivity` |
293
- | [Flux Prompt Generator](https://chat-preview.lobehub.com/market?agent=flux-prompt-generator)<br/><sup>By **[tcmonster](https://github.com/tcmonster)** on **2024-09-29**</sup> | Flux Prompt Generation Assistant: Expert in crafting detailed, creative prompts for high-quality image outputs from the Flux model.<br/>`prompt-generation` `image-generation` `art-style` `creativity` `crafting` |
294
294
 
295
- > 📊 Total agents: [<kbd>**404**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
295
+ > 📊 Total agents: [<kbd>**405**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
296
296
 
297
297
  <!-- AGENT LIST -->
298
298
 
package/README.zh-CN.md CHANGED
@@ -273,14 +273,14 @@ LobeChat 的插件生态系统是其核心功能的重要扩展,它极大地
273
273
 
274
274
  <!-- AGENT LIST -->
275
275
 
276
- | 最近新增 | 助手说明 |
277
- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
278
- | [C++/Qt](https://chat-preview.lobehub.com/market?agent=qt-c)<br/><sup>By **[liangyuR](https://github.com/liangyuR)** on **2024-09-30**</sup> | 擅长教授 C++/Qt 编程实践<br/>`c` `qt` |
279
- | [生日邀请信息](https://chat-preview.lobehub.com/market?agent=birthday-invitation-message)<br/><sup>By **[tcmonster](https://github.com/tcmonster)** on **2024-09-29**</sup> | 专注于制作引人入胜和个性化的生日邀请信息,适应各种主题和语气。<br/>`信息构成` `个性化` `语气多样性` `活动细节整合` `互动方式` |
280
- | [忌日信息](https://chat-preview.lobehub.com/market?agent=death-anniversary-message)<br/><sup>By **[tcmonster](https://github.com/tcmonster)** on **2024-09-29**</sup> | 专注于以同情和共情的方式撰写敏感且发自内心的忌日信息。<br/>`慰问` `信息撰写` `悲伤支持` `文化意识` `情感敏感性` |
281
- | [Flux 提示生成器](https://chat-preview.lobehub.com/market?agent=flux-prompt-generator)<br/><sup>By **[tcmonster](https://github.com/tcmonster)** on **2024-09-29**</sup> | Flux 提示生成助手:专注于为 Flux 模型生成高质量图像输出而创作详细、创意提示的专家。<br/>`提示生成` `图像生成` `艺术风格` `创意` `创作` |
282
-
283
- > 📊 Total agents: [<kbd>**404**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
276
+ | 最近新增 | 助手说明 |
277
+ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
278
+ | [更勤奋的助手](https://chat-preview.lobehub.com/market?agent=web-development)<br/><sup>By **[fasdfsdf-alt](https://github.com/fasdfsdf-alt)** on **2024-10-02**</sup> | 更勤奋的助手<br/>`学习` |
279
+ | [C++/Qt](https://chat-preview.lobehub.com/market?agent=qt-c)<br/><sup>By **[liangyuR](https://github.com/liangyuR)** on **2024-09-30**</sup> | 擅长教授 C++/Qt 编程实践<br/>`c` `qt` |
280
+ | [生日邀请信息](https://chat-preview.lobehub.com/market?agent=birthday-invitation-message)<br/><sup>By **[tcmonster](https://github.com/tcmonster)** on **2024-09-29**</sup> | 专注于制作引人入胜和个性化的生日邀请信息,适应各种主题和语气。<br/>`信息构成` `个性化` `语气多样性` `活动细节整合` `互动方式` |
281
+ | [忌日信息](https://chat-preview.lobehub.com/market?agent=death-anniversary-message)<br/><sup>By **[tcmonster](https://github.com/tcmonster)** on **2024-09-29**</sup> | 专注于以同情和共情的方式撰写敏感且发自内心的忌日信息。<br/>`慰问` `信息撰写` `悲伤支持` `文化意识` `情感敏感性` |
282
+
283
+ > 📊 Total agents: [<kbd>**405**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
284
284
 
285
285
  <!-- AGENT LIST -->
286
286
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.21.6",
3
+ "version": "1.21.8",
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",
@@ -300,7 +300,7 @@
300
300
  "vitest": "~1.2.2",
301
301
  "vitest-canvas-mock": "^0.3.3"
302
302
  },
303
- "packageManager": "pnpm@9.11.0",
303
+ "packageManager": "pnpm@9.12.0",
304
304
  "publishConfig": {
305
305
  "access": "public",
306
306
  "registry": "https://registry.npmjs.org"
@@ -1,11 +1,11 @@
1
1
  export const LANGCHAIN_SUPPORT_TEXT_LIST = [
2
2
  'txt',
3
- 'md',
4
3
  'markdown',
5
4
  'md',
6
5
  'mdx',
7
6
  'toml',
8
7
  'yaml',
8
+ 'yml',
9
9
  'json',
10
10
 
11
11
  'sh',
package/src/middleware.ts CHANGED
@@ -9,7 +9,7 @@ import { OAUTH_AUTHORIZED } from './const/auth';
9
9
  export const config = {
10
10
  matcher: [
11
11
  // include any files in the api or trpc folders that might have an extension
12
- '/(api|trpc)(.*)',
12
+ '/(api|trpc|webapi)(.*)',
13
13
  // include the /
14
14
  '/',
15
15
  '/chat(.*)',
@@ -36,7 +36,7 @@ export const API_ENDPOINTS = mapWithBasePath({
36
36
  trace: '/webapi/trace',
37
37
 
38
38
  // image
39
- images: '/webapi/text-to-image/openai',
39
+ images: (provider: string) => `/webapi/text-to-image/${provider}`,
40
40
 
41
41
  // STT
42
42
  stt: '/webapi/stt/openai',
@@ -12,12 +12,14 @@ class ImageGenerationService {
12
12
  async generateImage(params: Omit<OpenAIImagePayload, 'model' | 'n'>, options?: FetchOptions) {
13
13
  const payload: OpenAIImagePayload = { ...params, model: 'dall-e-3', n: 1 };
14
14
 
15
+ const provider = ModelProvider.OpenAI;
16
+
15
17
  const headers = await createHeaderWithAuth({
16
18
  headers: { 'Content-Type': 'application/json' },
17
- provider: ModelProvider.OpenAI,
19
+ provider,
18
20
  });
19
21
 
20
- const res = await fetch(API_ENDPOINTS.images, {
22
+ const res = await fetch(API_ENDPOINTS.images(provider), {
21
23
  body: JSON.stringify(payload),
22
24
  headers: headers,
23
25
  method: 'POST',
@@ -67,9 +67,10 @@ export const chatRag: StateCreator<ChatStore, [['zustand/devtools', never]], [],
67
67
  // 1. get the rewrite query
68
68
  let rewriteQuery = message?.ragQuery || userQuery;
69
69
 
70
+ // only rewrite query length is less than 10 characters
70
71
  // if there is no ragQuery and there is a chat history
71
72
  // we need to rewrite the user message to get better results
72
- if (!message?.ragQuery && messages.length > 0) {
73
+ if (rewriteQuery.length < 10 && !message?.ragQuery && messages.length > 0) {
73
74
  rewriteQuery = await get().internal_rewriteQuery(id, userQuery, messages);
74
75
  }
75
76