@lobehub/chat 0.147.18 → 0.147.19

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,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 0.147.19](https://github.com/lobehub/lobe-chat/compare/v0.147.18...v0.147.19)
6
+
7
+ <sup>Released on **2024-04-18**</sup>
8
+
9
+ #### 💄 Styles
10
+
11
+ - **misc**: Add M and B support max token in ModelInfoTags.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Styles
19
+
20
+ - **misc**: Add M and B support max token in ModelInfoTags, closes [#2073](https://github.com/lobehub/lobe-chat/issues/2073) ([a985d8f](https://github.com/lobehub/lobe-chat/commit/a985d8f))
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
+
5
30
  ### [Version 0.147.18](https://github.com/lobehub/lobe-chat/compare/v0.147.17...v0.147.18)
6
31
 
7
32
  <sup>Released on **2024-04-17**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.147.18",
3
+ "version": "0.147.19",
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",
@@ -56,11 +56,17 @@ const useStyles = createStyles(({ css, token }) => ({
56
56
  border-radius: 4px;
57
57
  `,
58
58
  }));
59
+ const formatTokenNumber = (num: number): string => {
60
+ if (num < 1000) return '1K';
61
+ const kiloToken = Math.floor(num / 1000);
62
+ return kiloToken < 1000 ? `${kiloToken}K` : `${Math.floor(kiloToken / 1000)}M`;
63
+ }
59
64
 
60
65
  interface ModelInfoTagsProps extends ChatModelCard {
61
66
  directionReverse?: boolean;
62
67
  placement?: 'top' | 'right';
63
68
  }
69
+
64
70
  export const ModelInfoTags = memo<ModelInfoTagsProps>(
65
71
  ({ directionReverse, placement = 'right', ...model }) => {
66
72
  const { t } = useTranslation('components');
@@ -101,7 +107,7 @@ export const ModelInfoTags = memo<ModelInfoTagsProps>(
101
107
  tokens: numeral(model.tokens).format('0,0'),
102
108
  })}
103
109
  >
104
- <Center className={styles.token}>{Math.floor(model.tokens / 1000)}K</Center>
110
+ <Center className={styles.token}>{formatTokenNumber(model.tokens)}</Center>
105
111
  </Tooltip>
106
112
  )}
107
113
  {/*{model.isCustom && (*/}
@@ -121,6 +127,7 @@ export const ModelInfoTags = memo<ModelInfoTagsProps>(
121
127
  interface ModelItemRenderProps extends ChatModelCard {
122
128
  showInfoTag?: boolean;
123
129
  }
130
+
124
131
  export const ModelItemRender = memo<ModelItemRenderProps>(({ showInfoTag = true, ...model }) => {
125
132
  return (
126
133
  <Flexbox align={'center'} gap={32} horizontal justify={'space-between'}>