@lobehub/chat 0.27.2 → 0.27.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,64 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
### [Version 0.27.4](https://github.com/lobehub/lobe-chat/compare/v0.27.3...v0.27.4)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2023-07-29**</sup>
|
|
8
|
+
|
|
9
|
+
#### 🐛 Bug Fixes
|
|
10
|
+
|
|
11
|
+
- **misc**: 修正日志超过 4096 长度的问题.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's fixed
|
|
19
|
+
|
|
20
|
+
- **misc**: 修正日志超过 4096 长度的问题 ([6066aff](https://github.com/lobehub/lobe-chat/commit/6066aff))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
### [Version 0.27.3](https://github.com/lobehub/lobe-chat/compare/v0.27.2...v0.27.3)
|
|
31
|
+
|
|
32
|
+
<sup>Released on **2023-07-29**</sup>
|
|
33
|
+
|
|
34
|
+
#### 🐛 Bug Fixes
|
|
35
|
+
|
|
36
|
+
- **misc**: 修正返回结果导致插件无法正常识别的问题.
|
|
37
|
+
|
|
38
|
+
#### 💄 Styles
|
|
39
|
+
|
|
40
|
+
- **misc**: 优化样式.
|
|
41
|
+
|
|
42
|
+
<br/>
|
|
43
|
+
|
|
44
|
+
<details>
|
|
45
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
46
|
+
|
|
47
|
+
#### What's fixed
|
|
48
|
+
|
|
49
|
+
- **misc**: 修正返回结果导致插件无法正常识别的问题 ([b183188](https://github.com/lobehub/lobe-chat/commit/b183188))
|
|
50
|
+
|
|
51
|
+
#### Styles
|
|
52
|
+
|
|
53
|
+
- **misc**: 优化样式 ([9ce5d1d](https://github.com/lobehub/lobe-chat/commit/9ce5d1d))
|
|
54
|
+
|
|
55
|
+
</details>
|
|
56
|
+
|
|
57
|
+
<div align="right">
|
|
58
|
+
|
|
59
|
+
[](#readme-top)
|
|
60
|
+
|
|
61
|
+
</div>
|
|
62
|
+
|
|
5
63
|
### [Version 0.27.2](https://github.com/lobehub/lobe-chat/compare/v0.27.1...v0.27.2)
|
|
6
64
|
|
|
7
65
|
<sup>Released on **2023-07-29**</sup>
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@ export default async function handler(req: Request) {
|
|
|
15
15
|
const data = JSON.parse(args);
|
|
16
16
|
const result = await func.runner(data);
|
|
17
17
|
|
|
18
|
-
console.log(`[${name}]`, args, `result:`, JSON.stringify(result, null, 2));
|
|
18
|
+
console.log(`[${name}]`, args, `result:`, JSON.stringify(result, null, 2).slice(0, 3600));
|
|
19
19
|
|
|
20
20
|
return new Response(JSON.stringify(result));
|
|
21
21
|
}
|
|
@@ -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
|
-
|
|
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
|
|
2
|
+
content: string;
|
|
3
3
|
title?: string;
|
|
4
|
-
url
|
|
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
|
+
}
|