@lobehub/chat 0.96.3 โ†’ 0.96.5

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.96.5](https://github.com/lobehub/lobe-chat/compare/v0.96.4...v0.96.5)
6
+
7
+ <sup>Released on **2023-10-29**</sup>
8
+
9
+ #### ๐Ÿ› Bug Fixes
10
+
11
+ - **misc**: Fix docker image optimization error log.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Fix docker image optimization error log ([730aec1](https://github.com/lobehub/lobe-chat/commit/730aec1))
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.96.4](https://github.com/lobehub/lobe-chat/compare/v0.96.3...v0.96.4)
31
+
32
+ <sup>Released on **2023-10-29**</sup>
33
+
34
+ #### ๐Ÿ› Bug Fixes
35
+
36
+ - **misc**: Fix agents market locale fallback to english.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### What's fixed
44
+
45
+ - **misc**: Fix agents market locale fallback to english, closes [#382](https://github.com/lobehub/lobe-chat/issues/382) ([3814523](https://github.com/lobehub/lobe-chat/commit/3814523))
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.96.3](https://github.com/lobehub/lobe-chat/compare/v0.96.2...v0.96.3)
6
56
 
7
57
  <sup>Released on **2023-10-28**</sup>
@@ -218,7 +268,7 @@
218
268
 
219
269
  #### ๐Ÿ› Bug Fixes
220
270
 
221
- - **misc**: Fix agent share formate.
271
+ - **misc**: Fix agent share format.
222
272
 
223
273
  <br/>
224
274
 
@@ -227,7 +277,7 @@
227
277
 
228
278
  #### What's fixed
229
279
 
230
- - **misc**: Fix agent share formate ([56ebc0b](https://github.com/lobehub/lobe-chat/commit/56ebc0b))
280
+ - **misc**: Fix agent share format ([56ebc0b](https://github.com/lobehub/lobe-chat/commit/56ebc0b))
231
281
 
232
282
  </details>
233
283
 
@@ -1029,7 +1079,7 @@
1029
1079
 
1030
1080
  #### ๐Ÿ› Bug Fixes
1031
1081
 
1032
- - **misc**: Fix mobile safearea (fix.
1082
+ - **misc**: Fix mobile safe area (fix.
1033
1083
 
1034
1084
  <br/>
1035
1085
 
@@ -1038,7 +1088,7 @@
1038
1088
 
1039
1089
  #### What's fixed
1040
1090
 
1041
- - **misc**: Fix mobile safearea (fix, closes [#211](https://github.com/lobehub/lobe-chat/issues/211) ([68775b8](https://github.com/lobehub/lobe-chat/commit/68775b8))
1091
+ - **misc**: Fix mobile safe area (fix, closes [#211](https://github.com/lobehub/lobe-chat/issues/211) ([68775b8](https://github.com/lobehub/lobe-chat/commit/68775b8))
1042
1092
 
1043
1093
  </details>
1044
1094
 
@@ -1688,7 +1738,7 @@
1688
1738
 
1689
1739
  #### ๐Ÿ’„ Styles
1690
1740
 
1691
- - **misc**: Fix conversation mobile viewarea.
1741
+ - **misc**: Fix conversation mobile view area.
1692
1742
 
1693
1743
  <br/>
1694
1744
 
@@ -1697,7 +1747,7 @@
1697
1747
 
1698
1748
  #### Styles
1699
1749
 
1700
- - **misc**: Fix conversation mobile viewarea ([6668e11](https://github.com/lobehub/lobe-chat/commit/6668e11))
1750
+ - **misc**: Fix conversation mobile view area ([6668e11](https://github.com/lobehub/lobe-chat/commit/6668e11))
1701
1751
 
1702
1752
  </details>
1703
1753
 
@@ -1738,7 +1788,7 @@
1738
1788
 
1739
1789
  #### ๐Ÿ’„ Styles
1740
1790
 
1741
- - **misc**: Fix safeare in mobile.
1791
+ - **misc**: Fix safearea in mobile.
1742
1792
 
1743
1793
  <br/>
1744
1794
 
@@ -1747,7 +1797,7 @@
1747
1797
 
1748
1798
  #### Styles
1749
1799
 
1750
- - **misc**: Fix safeare in mobile ([2adfb04](https://github.com/lobehub/lobe-chat/commit/2adfb04))
1800
+ - **misc**: Fix safearea in mobile ([2adfb04](https://github.com/lobehub/lobe-chat/commit/2adfb04))
1751
1801
 
1752
1802
  </details>
1753
1803
 
@@ -1788,7 +1838,7 @@
1788
1838
 
1789
1839
  #### ๐Ÿ’„ Styles
1790
1840
 
1791
- - **misc**: Optmize PWA style and scroll effect.
1841
+ - **misc**: Optimize PWA style and scroll effect.
1792
1842
 
1793
1843
  <br/>
1794
1844
 
@@ -1797,7 +1847,7 @@
1797
1847
 
1798
1848
  #### Styles
1799
1849
 
1800
- - **misc**: Optmize PWA style and scroll effect ([0ae05b8](https://github.com/lobehub/lobe-chat/commit/0ae05b8))
1850
+ - **misc**: Optimize PWA style and scroll effect ([0ae05b8](https://github.com/lobehub/lobe-chat/commit/0ae05b8))
1801
1851
 
1802
1852
  </details>
1803
1853
 
@@ -2224,7 +2274,7 @@
2224
2274
 
2225
2275
  #### โœจ Features
2226
2276
 
2227
- - **misc**: Add russian localy, Update Russian and English localy (LLM tab).
2277
+ - **misc**: Add russian locally, Update Russian and English locally (LLM tab).
2228
2278
 
2229
2279
  <br/>
2230
2280
 
@@ -2233,8 +2283,8 @@
2233
2283
 
2234
2284
  #### What's improved
2235
2285
 
2236
- - **misc**: Add russian localy ([7b67c9f](https://github.com/lobehub/lobe-chat/commit/7b67c9f))
2237
- - **misc**: Update Russian and English localy (LLM tab) ([3b23e70](https://github.com/lobehub/lobe-chat/commit/3b23e70))
2286
+ - **misc**: Add russian locally ([7b67c9f](https://github.com/lobehub/lobe-chat/commit/7b67c9f))
2287
+ - **misc**: Update Russian and English locally (LLM tab) ([3b23e70](https://github.com/lobehub/lobe-chat/commit/3b23e70))
2238
2288
 
2239
2289
  </details>
2240
2290
 
@@ -2593,7 +2643,7 @@
2593
2643
 
2594
2644
  #### โ™ป Code Refactoring
2595
2645
 
2596
- - **misc**: Mirgrate openai-edge to openai.
2646
+ - **misc**: Migrate openai-edge to openai.
2597
2647
 
2598
2648
  <br/>
2599
2649
 
@@ -2602,7 +2652,7 @@
2602
2652
 
2603
2653
  #### Code refactoring
2604
2654
 
2605
- - **misc**: Mirgrate openai-edge to openai, closes [#145](https://github.com/lobehub/lobe-chat/issues/145) ([75ee574](https://github.com/lobehub/lobe-chat/commit/75ee574))
2655
+ - **misc**: Migrate openai-edge to openai, closes [#145](https://github.com/lobehub/lobe-chat/issues/145) ([75ee574](https://github.com/lobehub/lobe-chat/commit/75ee574))
2606
2656
 
2607
2657
  </details>
2608
2658
 
@@ -2737,7 +2787,7 @@
2737
2787
 
2738
2788
  #### โœจ Features
2739
2789
 
2740
- - **misc**: Add russian localy.
2790
+ - **misc**: Add russian locally.
2741
2791
 
2742
2792
  <br/>
2743
2793
 
@@ -2746,7 +2796,7 @@
2746
2796
 
2747
2797
  #### What's improved
2748
2798
 
2749
- - **misc**: Add russian localy, closes [#137](https://github.com/lobehub/lobe-chat/issues/137) ([785d50f](https://github.com/lobehub/lobe-chat/commit/785d50f))
2799
+ - **misc**: Add russian locally, closes [#137](https://github.com/lobehub/lobe-chat/issues/137) ([785d50f](https://github.com/lobehub/lobe-chat/commit/785d50f))
2750
2800
 
2751
2801
  </details>
2752
2802
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.96.3",
3
+ "version": "0.96.5",
4
4
  "description": "An open-source, extensible (Function Calling), high-performance chatbot framework. It supports one-click free deployment of your private ChatGPT/LLM web application",
5
5
  "keywords": [
6
6
  "chatbot",
@@ -154,6 +154,7 @@
154
154
  "prettier": "^3",
155
155
  "remark-cli": "^11",
156
156
  "semantic-release": "^21",
157
+ "sharp": "^0.32.6",
157
158
  "stylelint": "^15",
158
159
  "ts-node": "^10",
159
160
  "typescript": "^5",
@@ -0,0 +1,19 @@
1
+ import { DEFAULT_LANG } from '@/const/locale';
2
+ import { getAgentJSON } from '@/const/url';
3
+
4
+ export const runtime = 'edge';
5
+
6
+ export const GET = async (req: Request, { params }: { params: { id: string } }) => {
7
+ const { searchParams } = new URL(req.url);
8
+
9
+ const locale = searchParams.get('locale');
10
+
11
+ let res: Response;
12
+
13
+ res = await fetch(getAgentJSON(params.id, locale as any));
14
+ if (res.status === 404) {
15
+ res = await fetch(getAgentJSON(params.id, DEFAULT_LANG));
16
+ }
17
+
18
+ return res;
19
+ };
@@ -0,0 +1,18 @@
1
+ import { DEFAULT_LANG } from '@/const/locale';
2
+ import { getAgentIndexJSON } from '@/const/url';
3
+
4
+ export const runtime = 'edge';
5
+
6
+ export const GET = async (req: Request) => {
7
+ const locale = new URL(req.url).searchParams.get('locale');
8
+
9
+ let res: Response;
10
+
11
+ res = await fetch(getAgentIndexJSON(locale as any));
12
+
13
+ if (res.status === 404) {
14
+ res = await fetch(getAgentIndexJSON(DEFAULT_LANG));
15
+ }
16
+
17
+ return res;
18
+ };
@@ -3,11 +3,8 @@ import { createStyles } from 'antd-style';
3
3
  export const useStyles = createStyles(({ css, token }) => ({
4
4
  prompt: css`
5
5
  overflow: hidden auto;
6
-
7
6
  padding: 0 16px 16px;
8
-
9
7
  opacity: 0.75;
10
-
11
8
  transition: opacity 200ms ${token.motionEaseOut};
12
9
 
13
10
  &:hover {
@@ -13,9 +13,7 @@ const useStyles = createStyles(({ css, cx, stylish }) => ({
13
13
  stylish.noScrollbar,
14
14
  css`
15
15
  position: relative;
16
-
17
16
  overflow: hidden auto;
18
-
19
17
  width: 100vw;
20
18
  height: 100%;
21
19
  `,
@@ -1,4 +1,5 @@
1
1
  export const URLS = {
2
+ market: '/api/market',
2
3
  plugins: '/api/plugins',
3
4
  };
4
5
 
@@ -1,30 +1,21 @@
1
- import { getAgentIndexJSON, getAgentJSON } from '@/const/url';
2
- import { getCurrentLanguage } from '@/store/global/helpers';
1
+ import { URLS } from '@/services/_url';
3
2
  import { LobeChatAgentsMarketIndex } from '@/types/market';
4
3
 
5
4
  /**
6
5
  * ่ฏทๆฑ‚ๅŠฉๆ‰‹ๅˆ—่กจ
7
6
  */
8
- export const getAgentList = async () => {
9
- let res: Response;
7
+ export const getAgentList = async (locale: string): Promise<LobeChatAgentsMarketIndex> => {
8
+ const res = await fetch(`${URLS.market}?locale=${locale}`);
10
9
 
11
- res = await fetch(getAgentIndexJSON(getCurrentLanguage()));
12
-
13
- if (res.status === 404) {
14
- res = await fetch(getAgentIndexJSON('en-US'));
15
- }
16
-
17
- const data: LobeChatAgentsMarketIndex = await res.json();
18
-
19
- return data;
10
+ return res.json();
20
11
  };
21
12
 
22
13
  /**
23
14
  * ่ฏทๆฑ‚ๅŠฉๆ‰‹ manifest
24
15
  */
25
- export const getAgentManifest = async (identifier?: string) => {
16
+ export const getAgentManifest = async (identifier: string, locale: string) => {
26
17
  if (!identifier) return;
27
- const res = await fetch(getAgentJSON(identifier, getCurrentLanguage()));
18
+ const res = await fetch(`${URLS.market}/${identifier}?locale=${locale}`);
28
19
 
29
20
  return res.json();
30
21
  };
@@ -4,6 +4,7 @@ import useSWR, { SWRResponse } from 'swr';
4
4
  import type { StateCreator } from 'zustand/vanilla';
5
5
 
6
6
  import { getAgentList, getAgentManifest } from '@/services/agentMarket';
7
+ import { getCurrentLanguage } from '@/store/global/helpers';
7
8
  import { AgentsMarketItem, LobeChatAgentsMarketIndex } from '@/types/market';
8
9
 
9
10
  import type { Store } from './store';
@@ -40,16 +41,20 @@ export const createMarketAction: StateCreator<
40
41
  set({ agentMap: nextAgentMap }, false, `setAgentMap/${key}`);
41
42
  },
42
43
  useFetchAgent: (identifier) =>
43
- useSWR<AgentsMarketItem>(identifier, getAgentManifest, {
44
- onError: () => {
45
- get().deactivateAgent();
44
+ useSWR<AgentsMarketItem>(
45
+ [identifier, getCurrentLanguage()],
46
+ ([id, locale]) => getAgentManifest(id, locale as string),
47
+ {
48
+ onError: () => {
49
+ get().deactivateAgent();
50
+ },
51
+ onSuccess: (data) => {
52
+ get().updateAgentMap(identifier, data);
53
+ },
46
54
  },
47
- onSuccess: (data, key) => {
48
- get().updateAgentMap(key, data);
49
- },
50
- }),
55
+ ),
51
56
  useFetchAgentList: () =>
52
- useSWR<LobeChatAgentsMarketIndex>('fetchAgentList', getAgentList, {
57
+ useSWR<LobeChatAgentsMarketIndex>(getCurrentLanguage(), getAgentList, {
53
58
  onSuccess: (agentMarketIndex) => {
54
59
  set({ agentList: agentMarketIndex.agents }, false, 'useFetchAgentList');
55
60
  },