@lobehub/chat 0.98.3 → 0.99.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/.dockerignore CHANGED
@@ -8,3 +8,4 @@ scripts
8
8
  docs
9
9
  .github
10
10
  *.md
11
+ .env.example
package/.env.example ADDED
@@ -0,0 +1,45 @@
1
+ # add a access code to lock your lobe-chat application, it should be a six length string
2
+ ACCESS_CODE=lobe66
3
+
4
+ # add your custom model name, multi model seperate by comma. for example gpt-3.5-1106,gpt-4-1106
5
+ # NEXT_PUBLIC_CUSTOM_MODELS=model1,model2,model3
6
+
7
+ # ---- only choose one from OpenAI Service and Azure OpenAI Service ---- #
8
+
9
+ ########################################
10
+ ############ OpenAI Service ############
11
+ ########################################
12
+
13
+ # you openai api key
14
+ OPENAI_API_KEY=sk-xxxxxxxxx
15
+
16
+ # use a proxy to connect to the OpenAI API
17
+ # OPENAI_PROXY_URL=https://api.openai.com/v1
18
+
19
+ ########################################
20
+ ######### Azure OpenAI Service #########
21
+ ########################################
22
+ # you can learn azure OpenAI Service on https://learn.microsoft.com/en-us/azure/ai-services/openai/overview
23
+
24
+ # use Azure OpenAI Service by uncomment the following line
25
+ # USE_AZURE_OPENAI=1
26
+
27
+ # The API key you applied for on the Azure OpenAI account page, which can be found in the "Keys and Endpoints" section.
28
+ # AZURE_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
29
+
30
+ # The endpoint you applied for on the Azure OpenAI account page, which can be found in the "Keys and Endpoints" section.
31
+ # OPENAI_PROXY_URL=https://docs-test-001.openai.azure.com
32
+
33
+ # Azure's API version, follows the YYYY-MM-DD format
34
+ # AZURE_API_VERSION=2023-08-01-preview
35
+
36
+ ########################################
37
+ ############ Market Service ############
38
+ ########################################
39
+
40
+ # The LobeChat plugins market index url
41
+ # PLUGINS_INDEX_URL=https://chat-plugins.lobehub.com
42
+
43
+ # The LobeChat agents market index url
44
+ # AGENTS_INDEX_URL=https://chat-agents.lobehub.com
45
+
@@ -8,6 +8,20 @@ permissions:
8
8
  contents: read
9
9
 
10
10
  jobs:
11
+ issue-check-inactive:
12
+ permissions:
13
+ issues: write # for actions-cool/issues-helper to update issues
14
+ pull-requests: write # for actions-cool/issues-helper to update PRs
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - name: check-inactive
18
+ uses: actions-cool/issues-helper@v3
19
+ with:
20
+ actions: 'check-inactive'
21
+ token: ${{ secrets.GH_TOKEN }}
22
+ inactive-label: 'Inactive'
23
+ inactive-day: 30
24
+
11
25
  issue-close-require:
12
26
  permissions:
13
27
  issues: write # for actions-cool/issues-helper to update issues
@@ -0,0 +1,14 @@
1
+ name: Issue Translate
2
+ on:
3
+ issue_comment:
4
+ types: [created]
5
+ issues:
6
+ types: [opened]
7
+
8
+ jobs:
9
+ build:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: usthe/issues-translate-action@v2.7
13
+ with:
14
+ BOT_GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
package/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ## [Version 0.99.0](https://github.com/lobehub/lobe-chat/compare/v0.98.3...v0.99.0)
6
+
7
+ <sup>Released on **2023-11-08**</sup>
8
+
9
+ #### ✨ Features
10
+
11
+ - **misc**: Add Environment Variable for custom model name when deploying.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's improved
19
+
20
+ - **misc**: Add Environment Variable for custom model name when deploying, closes [#429](https://github.com/lobehub/lobe-chat/issues/429) ([15f9fa2](https://github.com/lobehub/lobe-chat/commit/15f9fa2))
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.98.3](https://github.com/lobehub/lobe-chat/compare/v0.98.2...v0.98.3)
6
31
 
7
32
  <sup>Released on **2023-11-07**</sup>
@@ -6,6 +6,7 @@ LobeChat provides additional configuration options during deployment, which can
6
6
 
7
7
  - [General Variables](#general-variables)
8
8
  - [`ACCESS_CODE`](#access_code)
9
+ - [`NEXT_PUBLIC_CUSTOM_MODELS`](#next_public_custom_models)
9
10
  - [OpenAI](#openai)
10
11
  - [`OPENAI_API_KEY`](#openai_api_key)
11
12
  - [`OPENAI_PROXY_URL`](#openai_proxy_url)
@@ -18,6 +19,7 @@ LobeChat provides additional configuration options during deployment, which can
18
19
  - [Agent Service](#agent-service)
19
20
  - [`AGENTS_INDEX_URL`](#agents_index_url)
20
21
  - [Data Analytics](#data-analytics)
22
+ - [Vercel Analytics](#vercel-analytics)
21
23
  - [Posthog Analytics](#posthog-analytics)
22
24
 
23
25
  ## General Variables
@@ -26,10 +28,15 @@ LobeChat provides additional configuration options during deployment, which can
26
28
 
27
29
  - Type: Optional
28
30
  - Description: Add a password to access the LobeChat service, the password should be 6 digits or letters
29
- - Default: -
31
+ - Default: `-`
30
32
  - Example: `awCT74` or `e3@09!`
31
33
 
32
- <br/>
34
+ ### `NEXT_PUBLIC_CUSTOM_MODELS`
35
+
36
+ - Type: Optional
37
+ - Description: add your custom model name, multi model seperate by comma. for example: `gpt-3.5-1106,gpt-4-1106`
38
+ - Default: `-`
39
+ - Example: `model1,model2,model3`
33
40
 
34
41
  ## OpenAI
35
42
 
@@ -37,7 +44,7 @@ LobeChat provides additional configuration options during deployment, which can
37
44
 
38
45
  - Type: Required
39
46
  - Description: This is the API key you apply for on the OpenAI account page, you can go [here][openai-api-page] to view
40
- - Default: -
47
+ - Default: `-`
41
48
  - Example: `sk-xxxxxx...xxxxxx`
42
49
 
43
50
  ### `OPENAI_PROXY_URL`
@@ -57,14 +64,14 @@ If you need to use Azure OpenAI to provide model services, you can refer to the
57
64
 
58
65
  - Type: Optional
59
66
  - Description: Set this value to `1` to enable Azure OpenAI configuration
60
- - Default: -
67
+ - Default: `-`
61
68
  - Example: `1`
62
69
 
63
70
  ### `AZURE_API_KEY`
64
71
 
65
72
  - Type: Optional
66
73
  - Description: This is the API key you apply for on the Azure OpenAI account page
67
- - Default: -
74
+ - Default: `-`
68
75
  - Example: `c55168be3874490ef0565d9779ecd5a6`
69
76
 
70
77
  ### `AZURE_API_VERSION`
@@ -98,13 +105,29 @@ If you need to use Azure OpenAI to provide model services, you can refer to the
98
105
 
99
106
  ## Data Analytics
100
107
 
108
+ ### Vercel Analytics
109
+
110
+ #### `NEXT_PUBLIC_ANALYTICS_VERCEL`
111
+
112
+ - Type: Optional
113
+ - Description: Environment variable to enable [Vercel Analytics][vercel-analytics-url]. Set to `1` to enable Vercel Analytics.
114
+ - Default: `-`
115
+ - Example: `1`
116
+
117
+ #### `NEXT_PUBLIC_VERCEL_DEBUG`
118
+
119
+ - Type: Optional
120
+ - Description: Enable debug mode for Vercel Analytics.
121
+ - Default: `-`
122
+ - Example: `1`
123
+
101
124
  ### Posthog Analytics
102
125
 
103
126
  #### `NEXT_PUBLIC_ANALYTICS_POSTHOG`
104
127
 
105
128
  - Type: Optional
106
- - Description: Environment variable to enable \[PostHog Analytics]\[posthog-analytics-url]. Set to `1` to enable PostHog Analytics.
107
- - Default: -
129
+ - Description: Environment variable to enable [PostHog Analytics][posthog-analytics-url]. Set to `1` to enable PostHog Analytics.
130
+ - Default: `-`
108
131
  - Example: `1`
109
132
 
110
133
  #### `NEXT_PUBLIC_POSTHOG_KEY`
@@ -130,3 +153,5 @@ If you need to use Azure OpenAI to provide model services, you can refer to the
130
153
 
131
154
  [azure-api-verion-url]: https://docs.microsoft.com/zh-cn/azure/developer/javascript/api-reference/es-modules/azure-sdk/ai-translation/translationconfiguration?view=azure-node-latest#api-version
132
155
  [openai-api-page]: https://platform.openai.com/account/api-keys
156
+ [posthog-analytics-url]: https://posthog.com
157
+ [vercel-analytics-url]: https://vercel.com/analytics
@@ -6,6 +6,7 @@ LobeChat 在部署时提供了一些额外的配置项,使用环境变量进
6
6
 
7
7
  - [通用变量](#通用变量)
8
8
  - [`ACCESS_CODE`](#access_code)
9
+ - [`NEXT_PUBLIC_CUSTOM_MODELS`](#next_public_custom_models)
9
10
  - [OpenAI](#openai)
10
11
  - [`OPENAI_API_KEY`](#openai_api_key)
11
12
  - [`OPENAI_PROXY_URL`](#openai_proxy_url)
@@ -30,7 +31,12 @@ LobeChat 在部署时提供了一些额外的配置项,使用环境变量进
30
31
  - 默认值:-
31
32
  - 示例:`awCT74` 或 `e3@09!`
32
33
 
33
- <br/>
34
+ ### `NEXT_PUBLIC_CUSTOM_MODELS`
35
+
36
+ - 类型:可选
37
+ - 描述:添加自定义模型名称,多个模型需要使用逗号 `,` 隔开。 比如: `gpt-3.5-1106,gpt-4-1106`
38
+ - 默认值:`-`
39
+ - 示例:`model1,model2,model3`
34
40
 
35
41
  ## OpenAI
36
42
 
@@ -75,8 +81,6 @@ LobeChat 在部署时提供了一些额外的配置项,使用环境变量进
75
81
  - 默认值:`2023-08-01-preview`
76
82
  - 示例:`2023-05-15`,查阅[最新版本][azure-api-verion-url]
77
83
 
78
- <br/>
79
-
80
84
  ## 插件服务
81
85
 
82
86
  ### `PLUGINS_INDEX_URL`
@@ -85,8 +89,6 @@ LobeChat 在部署时提供了一些额外的配置项,使用环境变量进
85
89
  - 描述:LobeChat 插件市场的索引地址,如果你自行部署了插件市场的服务,可以使用该变量来覆盖默认的插件市场地址
86
90
  - 默认值:`https://chat-plugins.lobehub.com`
87
91
 
88
- <br/>
89
-
90
92
  ## 角色服务
91
93
 
92
94
  ### `AGENTS_INDEX_URL`
@@ -102,15 +104,15 @@ LobeChat 在部署时提供了一些额外的配置项,使用环境变量进
102
104
  #### `NEXT_PUBLIC_ANALYTICS_VERCEL`
103
105
 
104
106
  - 类型:可选
105
- - 描述:用于配置 Vercel Analytics 的环境变量,当设为 `0` 则关闭 Vercel Analytics
106
- - 默认值: -
107
- - 示例:`0`
107
+ - 描述:用于配置 Vercel Analytics 的环境变量,当设为 `1` 时开启 Vercel Analytics
108
+ - 默认值: `-`
109
+ - 示例:`1`
108
110
 
109
111
  #### `NEXT_PUBLIC_VERCEL_DEBUG`
110
112
 
111
113
  - 类型:可选
112
114
  - 描述:用于开启 Vercel Analytics 的调试模式
113
- - 默认值: -
115
+ - 默认值: `-`
114
116
  - 示例:`1`
115
117
 
116
118
  ### Posthog Analytics
@@ -119,14 +121,14 @@ LobeChat 在部署时提供了一些额外的配置项,使用环境变量进
119
121
 
120
122
  - 类型:可选
121
123
  - 描述:用于开启 [PostHog Analytics][posthog-analytics-url] 的环境变量,设为 `1` 时开启 PostHog Analytics
122
- - 默认值: -
124
+ - 默认值: `-`
123
125
  - 示例:`1`
124
126
 
125
127
  #### `NEXT_PUBLIC_POSTHOG_KEY`
126
128
 
127
129
  - 类型:可选
128
130
  - 描述:设置 PostHog 项目 Key
129
- - 默认值: -
131
+ - 默认值: `-`
130
132
  - 示例:`phc_xxxxxxxx`
131
133
 
132
134
  #### `NEXT_PUBLIC_POSTHOG_HOST`
@@ -140,7 +142,7 @@ LobeChat 在部署时提供了一些额外的配置项,使用环境变量进
140
142
 
141
143
  - 类型:可选
142
144
  - 描述:开启 PostHog 的调试模式
143
- - 默认值: -
145
+ - 默认值: `-`
144
146
  - 示例:`1`
145
147
 
146
148
  [azure-api-verion-url]: https://docs.microsoft.com/zh-cn/azure/developer/javascript/api-reference/es-modules/azure-sdk/ai-translation/translationconfiguration?view=azure-node-latest#api-version
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.98.3",
3
+ "version": "0.99.0",
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",
@@ -73,7 +73,7 @@
73
73
  "@lobehub/ui": "latest",
74
74
  "@vercel/analytics": "^1",
75
75
  "ahooks": "^3",
76
- "ai": "^2",
76
+ "ai": "2.2.20",
77
77
  "antd": "^5",
78
78
  "antd-style": "^3",
79
79
  "brotli-wasm": "^1",
@@ -7,6 +7,8 @@ declare global {
7
7
  AGENTS_INDEX_URL?: string;
8
8
  PLUGINS_INDEX_URL?: string;
9
9
 
10
+ NEXT_PUBLIC_CUSTOM_MODELS?: string;
11
+
10
12
  NEXT_PUBLIC_ANALYTICS_VERCEL?: string;
11
13
  NEXT_PUBLIC_VERCEL_DEBUG?: string;
12
14
 
@@ -33,6 +35,8 @@ declare global {
33
35
  export const getClientConfig = () => ({
34
36
  AGENTS_INDEX_URL: process.env.AGENTS_INDEX_URL,
35
37
  PLUGINS_INDEX_URL: process.env.PLUGINS_INDEX_URL,
38
+ // custom model names
39
+ CUSTOM_MODELS: process.env.NEXT_PUBLIC_CUSTOM_MODELS,
36
40
 
37
41
  // Vercel Analytics
38
42
  ANALYTICS_VERCEL: process.env.NEXT_PUBLIC_ANALYTICS_VERCEL === '1',
@@ -1,3 +1,4 @@
1
+ import { getClientConfig } from '@/config/client';
1
2
  import { DEFAULT_OPENAI_MODEL_LIST } from '@/const/llm';
2
3
  import { DEFAULT_AGENT_META } from '@/const/meta';
3
4
  import { LanguageModel } from '@/types/llm';
@@ -34,6 +35,8 @@ export const DEFAULT_AGENT_CONFIG: LobeAgentConfig = {
34
35
  export const DEFAULT_LLM_CONFIG: GlobalLLMConfig = {
35
36
  openAI: {
36
37
  OPENAI_API_KEY: '',
38
+ // support user custom model names with env var
39
+ customModelName: getClientConfig().CUSTOM_MODELS,
37
40
  models: DEFAULT_OPENAI_MODEL_LIST,
38
41
  },
39
42
  };
@@ -1,23 +0,0 @@
1
- name: Issue Check Inactive
2
-
3
- on:
4
- schedule:
5
- - cron: '0 0 */15 * *'
6
-
7
- permissions:
8
- contents: read
9
-
10
- jobs:
11
- issue-check-inactive:
12
- permissions:
13
- issues: write # for actions-cool/issues-helper to update issues
14
- pull-requests: write # for actions-cool/issues-helper to update PRs
15
- runs-on: ubuntu-latest
16
- steps:
17
- - name: check-inactive
18
- uses: actions-cool/issues-helper@v3
19
- with:
20
- actions: 'check-inactive'
21
- token: ${{ secrets.GH_TOKEN }}
22
- inactive-label: 'Inactive'
23
- inactive-day: 30