@lobehub/chat 1.70.6 → 1.70.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,56 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.70.8](https://github.com/lobehub/lobe-chat/compare/v1.70.7...v1.70.8)
6
+
7
+ <sup>Released on **2025-03-12**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Fix theme flicking.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Fix theme flicking, closes [#6926](https://github.com/lobehub/lobe-chat/issues/6926) ([103c3e3](https://github.com/lobehub/lobe-chat/commit/103c3e3))
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.70.7](https://github.com/lobehub/lobe-chat/compare/v1.70.6...v1.70.7)
31
+
32
+ <sup>Released on **2025-03-12**</sup>
33
+
34
+ #### 🐛 Bug Fixes
35
+
36
+ - **misc**: Fix crawl result for short content.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### What's fixed
44
+
45
+ - **misc**: Fix crawl result for short content, closes [#6903](https://github.com/lobehub/lobe-chat/issues/6903) [#6904](https://github.com/lobehub/lobe-chat/issues/6904) ([d8fda65](https://github.com/lobehub/lobe-chat/commit/d8fda65))
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.70.6](https://github.com/lobehub/lobe-chat/compare/v1.70.5...v1.70.6)
6
56
 
7
57
  <sup>Released on **2025-03-11**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,22 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "fixes": [
5
+ "Fix theme flicking."
6
+ ]
7
+ },
8
+ "date": "2025-03-12",
9
+ "version": "1.70.8"
10
+ },
11
+ {
12
+ "children": {
13
+ "fixes": [
14
+ "Fix crawl result for short content."
15
+ ]
16
+ },
17
+ "date": "2025-03-12",
18
+ "version": "1.70.7"
19
+ },
2
20
  {
3
21
  "children": {
4
22
  "fixes": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.70.6",
3
+ "version": "1.70.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",
@@ -23,7 +23,7 @@ describe('Crawler', () => {
23
23
 
24
24
  it('should crawl successfully with default impls', async () => {
25
25
  const mockResult = {
26
- content: 'test content',
26
+ content: 'test content'.padEnd(101, ' '), // Ensure content length > 100
27
27
  contentType: 'text' as const,
28
28
  url: 'https://example.com',
29
29
  };
@@ -45,7 +45,7 @@ describe('Crawler', () => {
45
45
 
46
46
  it('should use user provided impls', async () => {
47
47
  const mockResult = {
48
- content: 'test content',
48
+ content: 'test content'.padEnd(101, ' '), // Ensure content length > 100
49
49
  contentType: 'text' as const,
50
50
  url: 'https://example.com',
51
51
  };
@@ -93,7 +93,7 @@ describe('Crawler', () => {
93
93
 
94
94
  it('should handle transformed urls', async () => {
95
95
  const mockResult = {
96
- content: 'test content',
96
+ content: 'test content'.padEnd(101, ' '), // Ensure content length > 100
97
97
  contentType: 'text' as const,
98
98
  url: 'https://transformed.example.com',
99
99
  };
@@ -121,7 +121,7 @@ describe('Crawler', () => {
121
121
 
122
122
  it('should merge filter options correctly', async () => {
123
123
  const mockResult = {
124
- content: 'test content',
124
+ content: 'test content'.padEnd(101, ' '), // Ensure content length > 100
125
125
  contentType: 'text' as const,
126
126
  url: 'https://example.com',
127
127
  };
@@ -150,7 +150,7 @@ describe('Crawler', () => {
150
150
 
151
151
  it('should use rule impls when provided', async () => {
152
152
  const mockResult = {
153
- content: 'test content',
153
+ content: 'test content'.padEnd(101, ' '), // Ensure content length > 100
154
154
  contentType: 'text' as const,
155
155
  url: 'https://example.com',
156
156
  };
@@ -176,4 +176,32 @@ describe('Crawler', () => {
176
176
  transformedUrl: undefined,
177
177
  });
178
178
  });
179
+
180
+ it('should skip results with content length <= 100', async () => {
181
+ const mockResult = {
182
+ content: 'short content', // Content length <= 100
183
+ contentType: 'text' as const,
184
+ url: 'https://example.com',
185
+ };
186
+
187
+ const { crawlImpls } = await import('../crawImpl');
188
+ vi.mocked(crawlImpls.naive).mockResolvedValue(mockResult);
189
+ vi.mocked(crawlImpls.jina).mockResolvedValue(mockResult);
190
+ vi.mocked(crawlImpls.browserless).mockResolvedValue(mockResult);
191
+
192
+ const result = await crawler.crawl({
193
+ url: 'https://example.com',
194
+ });
195
+
196
+ expect(result).toEqual({
197
+ crawler: undefined,
198
+ data: {
199
+ content: 'Fail to crawl the page. Error type: UnknownError, error message: undefined',
200
+ errorMessage: undefined,
201
+ errorType: 'UnknownError',
202
+ },
203
+ originalUrl: 'https://example.com',
204
+ transformedUrl: undefined,
205
+ });
206
+ });
179
207
  });
@@ -56,7 +56,7 @@ export class Crawler {
56
56
  try {
57
57
  const res = await crawlImpls[impl](transformedUrl, { filterOptions: mergedFilterOptions });
58
58
 
59
- if (res)
59
+ if (res && res.content && res.content?.length > 100)
60
60
  return {
61
61
  crawler: impl,
62
62
  data: res,
@@ -14,7 +14,11 @@ import Link from 'next/link';
14
14
  import { ReactNode, memo, useEffect } from 'react';
15
15
 
16
16
  import AntdStaticMethods from '@/components/AntdStaticMethods';
17
- import { LOBE_THEME_NEUTRAL_COLOR, LOBE_THEME_PRIMARY_COLOR } from '@/const/theme';
17
+ import {
18
+ LOBE_THEME_APPEARANCE,
19
+ LOBE_THEME_NEUTRAL_COLOR,
20
+ LOBE_THEME_PRIMARY_COLOR,
21
+ } from '@/const/theme';
18
22
  import { useGlobalStore } from '@/store/global';
19
23
  import { systemStatusSelectors } from '@/store/global/selectors';
20
24
  import { useUserStore } from '@/store/user';
@@ -125,6 +129,11 @@ const AppTheme = memo<AppThemeProps>(
125
129
  primaryColor: primaryColor ?? defaultPrimaryColor,
126
130
  }}
127
131
  defaultAppearance={defaultAppearance}
132
+ onAppearanceChange={(appearance) => {
133
+ if (themeMode !== 'auto') return;
134
+
135
+ setCookie(LOBE_THEME_APPEARANCE, appearance);
136
+ }}
128
137
  theme={{
129
138
  cssVar: true,
130
139
  token: {