@lobehub/chat 0.30.0 → 0.31.0

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 0.31.0](https://github.com/lobehub/lobe-chat/compare/v0.30.1...v0.31.0)
6
+
7
+ <sup>Released on **2023-07-30**</sup>
8
+
9
+ #### ✨ Features
10
+
11
+ - **misc**: 支持展示 token 使用量.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's improved
19
+
20
+ - **misc**: 支持展示 token 使用量, closes [#31](https://github.com/lobehub/lobe-chat/issues/31) ([e4d4dac](https://github.com/lobehub/lobe-chat/commit/e4d4dac))
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 0.30.1](https://github.com/lobehub/lobe-chat/compare/v0.30.0...v0.30.1)
31
+
32
+ <sup>Released on **2023-07-30**</sup>
33
+
34
+ #### 💄 Styles
35
+
36
+ - **misc**: 优化搜索引擎插件展示.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### Styles
44
+
45
+ - **misc**: 优化搜索引擎插件展示 ([347e6b0](https://github.com/lobehub/lobe-chat/commit/347e6b0))
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 0.30.0](https://github.com/lobehub/lobe-chat/compare/v0.29.0...v0.30.0)
6
56
 
7
57
  <sup>Released on **2023-07-30**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.30.0",
3
+ "version": "0.31.0",
4
4
  "description": "Lobe Chat is an open-source chatbot client using LangChain, Typescript and Next.js",
5
5
  "keywords": [
6
6
  "chatbot",
@@ -1,4 +1,4 @@
1
- import { CodeEditor, FormGroup } from '@lobehub/ui';
1
+ import { CodeEditor, FormGroup, TokenTag } from '@lobehub/ui';
2
2
  import { createStyles } from 'antd-style';
3
3
  import { Bot } from 'lucide-react';
4
4
  import { memo } from 'react';
@@ -6,7 +6,8 @@ import { useTranslation } from 'react-i18next';
6
6
  import { shallow } from 'zustand/shallow';
7
7
 
8
8
  import { FORM_STYLE } from '@/const/layoutTokens';
9
- import { agentSelectors, useSessionStore } from '@/store/session';
9
+ import { ModelTokens } from '@/const/modelTokens';
10
+ import { agentSelectors, chatSelectors, useSessionStore } from '@/store/session';
10
11
 
11
12
  export const useStyles = createStyles(({ css, token }) => ({
12
13
  input: css`
@@ -24,12 +25,25 @@ export const useStyles = createStyles(({ css, token }) => ({
24
25
  const AgentPrompt = memo(() => {
25
26
  const { t } = useTranslation('setting');
26
27
 
27
- const systemRole = useSessionStore(agentSelectors.currentAgentSystemRole, shallow);
28
-
29
- const [updateAgentConfig] = useSessionStore((s) => [s.updateAgentConfig], shallow);
28
+ const [systemRole, model, systemTokenCount, updateAgentConfig] = useSessionStore(
29
+ (s) => [
30
+ agentSelectors.currentAgentSystemRole(s),
31
+ agentSelectors.currentAgentModel(s),
32
+ chatSelectors.systemRoleTokenCount(s),
33
+ s.updateAgentConfig,
34
+ ],
35
+ shallow,
36
+ );
30
37
 
31
38
  return (
32
- <FormGroup icon={Bot} style={FORM_STYLE.style} title={t('settingAgent.prompt.title')}>
39
+ <FormGroup
40
+ extra={
41
+ <TokenTag displayMode={'used'} maxValue={ModelTokens[model]} value={systemTokenCount} />
42
+ }
43
+ icon={Bot}
44
+ style={FORM_STYLE.style}
45
+ title={t('settingAgent.prompt.title')}
46
+ >
33
47
  <CodeEditor
34
48
  language={'md'}
35
49
  onValueChange={(e) => {
@@ -14,9 +14,8 @@ const useStyles = createStyles(({ css, token, cx }) => {
14
14
  `;
15
15
  return {
16
16
  container: css`
17
- :not(:last-child) {
18
- border-bottom: 1px solid ${token.colorBorder};
19
- }
17
+ overflow: scroll;
18
+ max-height: 370px;
20
19
  `,
21
20
  desc: css`
22
21
  color: ${token.colorTextTertiary};
@@ -27,6 +26,11 @@ const useStyles = createStyles(({ css, token, cx }) => {
27
26
  favicon: css`
28
27
  border-radius: 50%;
29
28
  `,
29
+ item: css`
30
+ :not(:last-child) {
31
+ border-bottom: 1px solid ${token.colorBorder};
32
+ }
33
+ `,
30
34
  link: css`
31
35
  &:hover {
32
36
  .${cx(title)} {
@@ -41,10 +45,10 @@ const useStyles = createStyles(({ css, token, cx }) => {
41
45
  const Render = memo<PluginRenderProps<Result>>(({ content }) => {
42
46
  const { styles } = useStyles();
43
47
  return (
44
- <Flexbox>
48
+ <Flexbox className={styles.container}>
45
49
  {content.map((item, index) => (
46
50
  <Flexbox
47
- className={styles.container}
51
+ className={styles.item}
48
52
  distribution={'space-between'}
49
53
  horizontal
50
54
  key={item.link}