@lobehub/chat 0.116.0 → 0.116.1

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.116.1](https://github.com/lobehub/lobe-chat/compare/v0.116.0...v0.116.1)
6
+
7
+ <sup>Released on **2023-12-26**</sup>
8
+
9
+ #### 💄 Styles
10
+
11
+ - **misc**: Support slider and select plugin setting render.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Styles
19
+
20
+ - **misc**: Support slider and select plugin setting render, closes [#819](https://github.com/lobehub/lobe-chat/issues/819) ([3190b44](https://github.com/lobehub/lobe-chat/commit/3190b44))
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.116.0](https://github.com/lobehub/lobe-chat/compare/v0.115.13...v0.116.0)
6
31
 
7
32
  <sup>Released on **2023-12-26**</sup>
package/README.md CHANGED
@@ -37,6 +37,7 @@ Supports one-click free deployment of your private ChatGPT/LLM web application.
37
37
  [![][share-reddit-shield]][share-reddit-link]
38
38
  [![][share-weibo-shield]][share-weibo-link]
39
39
  [![][share-mastodon-shield]][share-mastodon-link]
40
+ [![][share-linkedin-shield]][share-linkedin-link]
40
41
 
41
42
  <sup>Pioneering the new age of thinking and creating. Built for you, the Super Individual.</sup>
42
43
 
@@ -626,6 +627,8 @@ This project is [MIT](./LICENSE) licensed.
626
627
  [pr-welcome-link]: https://github.com/lobehub/lobe-chat/pulls
627
628
  [pr-welcome-shield]: https://img.shields.io/badge/🤯_pr_welcome-%E2%86%92-ffcb47?labelColor=black&style=for-the-badge
628
629
  [profile-link]: https://github.com/lobehub
630
+ [share-linkedin-link]: https://linkedin.com/feed
631
+ [share-linkedin-shield]: https://img.shields.io/badge/-share%20on%20linkedin-black?labelColor=black&logo=linkedin&logoColor=white&style=flat-square
629
632
  [share-mastodon-link]: https://mastodon.social/share?text=Check%20this%20GitHub%20repository%20out%20%F0%9F%A4%AF%20LobeChat%20-%20An%20open-source,%20extensible%20(Function%20Calling),%20high-performance%20chatbot%20framework.%20It%20supports%20one-click%20free%20deployment%20of%20your%20private%20ChatGPT/LLM%20web%20application.%20https://github.com/lobehub/lobe-chat%20#chatbot%20#chatGPT%20#openAI
630
633
  [share-mastodon-shield]: https://img.shields.io/badge/-share%20on%20mastodon-black?labelColor=black&logo=mastodon&logoColor=white&style=flat-square
631
634
  [share-reddit-link]: https://www.reddit.com/submit?title=Check%20this%20GitHub%20repository%20out%20%F0%9F%A4%AF%20LobeChat%20-%20An%20open-source%2C%20extensible%20%28Function%20Calling%29%2C%20high-performance%20chatbot%20framework.%20It%20supports%20one-click%20free%20deployment%20of%20your%20private%20ChatGPT%2FLLM%20web%20application.%20%23chatbot%20%23chatGPT%20%23openAI&url=https%3A%2F%2Fgithub.com%2Flobehub%2Flobe-chat
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.116.0",
3
+ "version": "0.116.1",
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",
@@ -140,6 +140,7 @@
140
140
  "@testing-library/jest-dom": "^6",
141
141
  "@testing-library/react": "^14",
142
142
  "@types/chroma-js": "^2",
143
+ "@types/json-schema": "^7.0.15",
143
144
  "@types/lodash": "^4",
144
145
  "@types/lodash-es": "^4",
145
146
  "@types/node": "^20",
@@ -1,16 +1,20 @@
1
- import { Input, InputNumber, Switch } from 'antd';
1
+ import { Input, InputNumber, Select, Slider, Switch } from 'antd';
2
+ import { JSONSchema7Type } from 'json-schema';
2
3
  import { memo } from 'react';
3
4
 
4
5
  interface PluginSettingsProps {
5
6
  defaultValue?: any;
7
+ enum?: JSONSchema7Type[];
6
8
  format?: string;
9
+ maximum?: number;
10
+ minimum?: number;
7
11
  onChange: (value: any) => void;
8
12
  props?: any;
9
13
  type?: 'string' | 'number' | 'boolean';
10
14
  }
11
15
 
12
16
  const PluginSettingRender = memo<PluginSettingsProps>(
13
- ({ type, defaultValue, onChange, format, props }) => {
17
+ ({ type, defaultValue, enum: enumItems, onChange, format, minimum, maximum, props }) => {
14
18
  switch (type) {
15
19
  case 'string': {
16
20
  switch (format) {
@@ -26,6 +30,19 @@ const PluginSettingRender = memo<PluginSettingsProps>(
26
30
  );
27
31
  }
28
32
  }
33
+
34
+ if (enumItems) {
35
+ return (
36
+ <Select
37
+ defaultValue={defaultValue}
38
+ onChange={onChange}
39
+ options={enumItems.map((i) =>
40
+ typeof i === 'string' ? { label: i, value: i } : (i as any),
41
+ )}
42
+ />
43
+ );
44
+ }
45
+
29
46
  return (
30
47
  <Input
31
48
  {...props}
@@ -36,7 +53,10 @@ const PluginSettingRender = memo<PluginSettingsProps>(
36
53
  />
37
54
  );
38
55
  }
56
+
39
57
  case 'number': {
58
+ if (typeof minimum === 'number' || typeof maximum === 'number')
59
+ return <Slider defaultValue={defaultValue} max={maximum} min={minimum} {...props} />;
40
60
  return (
41
61
  <InputNumber
42
62
  {...props}
@@ -15,8 +15,11 @@ export const transformPluginSettings = (pluginSettings: PluginSchema) => {
15
15
 
16
16
  return Object.entries(pluginSettings.properties).map(([name, i]) => ({
17
17
  desc: i.description,
18
+ enum: i.enum,
18
19
  format: i.format,
19
- label: i.title,
20
+ label: i.title || name,
21
+ maximum: i.maximum,
22
+ minimum: i.minimum,
20
23
  name,
21
24
  tag: name,
22
25
  type: i.type,
@@ -63,7 +66,10 @@ const PluginSettingsConfig = memo<PluginSettingsConfigProps>(({ schema, id }) =>
63
66
  >
64
67
  <PluginSettingRender
65
68
  defaultValue={pluginSetting[item.name]}
69
+ enum={item.enum}
66
70
  format={item.format}
71
+ maximum={item.maximum}
72
+ minimum={item.minimum}
67
73
  onChange={(value) => {
68
74
  updatePluginSettings(id, { [item.name]: value });
69
75
  }}