@lobehub/chat 0.27.2 → 0.27.3

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,39 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 0.27.3](https://github.com/lobehub/lobe-chat/compare/v0.27.2...v0.27.3)
6
+
7
+ <sup>Released on **2023-07-29**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: 修正返回结果导致插件无法正常识别的问题.
12
+
13
+ #### 💄 Styles
14
+
15
+ - **misc**: 优化样式.
16
+
17
+ <br/>
18
+
19
+ <details>
20
+ <summary><kbd>Improvements and Fixes</kbd></summary>
21
+
22
+ #### What's fixed
23
+
24
+ - **misc**: 修正返回结果导致插件无法正常识别的问题 ([b183188](https://github.com/lobehub/lobe-chat/commit/b183188))
25
+
26
+ #### Styles
27
+
28
+ - **misc**: 优化样式 ([9ce5d1d](https://github.com/lobehub/lobe-chat/commit/9ce5d1d))
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
+
5
38
  ### [Version 0.27.2](https://github.com/lobehub/lobe-chat/compare/v0.27.1...v0.27.2)
6
39
 
7
40
  <sup>Released on **2023-07-29**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.27.2",
3
+ "version": "0.27.3",
4
4
  "description": "Lobe Chat is an open-source chatbot client using LangChain, Typescript and Next.js",
5
5
  "keywords": [
6
6
  "chatbot",
@@ -49,7 +49,6 @@ const FunctionCall = memo<FunctionCallProps>(({ function_call, loading }) => {
49
49
  avatar
50
50
  )}
51
51
  {t(`plugins.${function_call?.name}` as any, { ns: 'plugin' })}
52
- {loading ? `(${t('loading.plugin')})` : null}
53
52
  <Icon icon={open ? LucideChevronUp : LucideChevronDown} />
54
53
  </Flexbox>
55
54
  {open && <Highlighter language={'json'}>{args}</Highlighter>}
@@ -1,6 +1,6 @@
1
1
  import { PluginRunner } from '@/plugins/type';
2
2
 
3
- import { Result } from './type';
3
+ import { ParserResponse, Result } from './type';
4
4
 
5
5
  const BASE_URL = process.env.BROWSERLESS_URL ?? 'https://chrome.browserless.io';
6
6
  const BROWSERLESS_TOKEN = process.env.BROWSERLESS_TOKEN;
@@ -34,10 +34,12 @@ const runner: PluginRunner<{ url: string }, Result> = async ({ url }) => {
34
34
  method: 'POST',
35
35
  });
36
36
 
37
- return await parseRes.json();
37
+ const { title, textContent, siteName } = (await parseRes.json()) as ParserResponse;
38
+
39
+ return { content: textContent, title, url, website: siteName };
38
40
  } catch (error) {
39
41
  console.error(error);
40
- return { content: '抓取失败', errorMessage: (error as any).message };
42
+ return { content: '抓取失败', errorMessage: (error as any).message, url };
41
43
  }
42
44
  };
43
45
 
@@ -1,5 +1,35 @@
1
1
  export type Result = {
2
- content?: string;
2
+ content: string;
3
3
  title?: string;
4
- url?: string;
4
+ url: string;
5
+ website?: string;
5
6
  };
7
+
8
+ export interface ParserResponse {
9
+ /** author metadata */
10
+ byline: string;
11
+
12
+ /** HTML string of processed article content */
13
+ content: string;
14
+
15
+ /** content direction */
16
+ dir: string;
17
+
18
+ /** article description, or short excerpt from the content */
19
+ excerpt: string;
20
+
21
+ /** content language */
22
+ lang: string;
23
+
24
+ /** length of an article, in characters */
25
+ length: number;
26
+
27
+ /** name of the site */
28
+ siteName: string;
29
+
30
+ /** text content of the article, with all the HTML tags removed */
31
+ textContent: string;
32
+
33
+ /** article title */
34
+ title: string;
35
+ }