@lobehub/chat 0.86.2 → 0.86.4

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.
@@ -4,6 +4,7 @@
4
4
 
5
5
  - [ ] ✨ feat
6
6
  - [ ] 🐛 fix
7
+ - [ ] ♻️ refactor
7
8
  - [ ] 💄 style
8
9
  - [ ] 🔨 chore
9
10
  - [ ] 📝 docs
@@ -1,4 +1,4 @@
1
- name: Publish Docker image
1
+ name: Publish Docker Image
2
2
 
3
3
  on:
4
4
  workflow_dispatch:
@@ -11,16 +11,16 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
  steps:
13
13
  - name: Check out the repo
14
- uses: actions/checkout@v3
14
+ uses: actions/checkout@v4
15
15
  - name: Log in to Docker Hub
16
- uses: docker/login-action@v2
16
+ uses: docker/login-action@v3
17
17
  with:
18
18
  username: ${{ secrets.DOCKER_REGISTRY_USER }}
19
19
  password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
20
20
 
21
21
  - name: Extract metadata (tags, labels) for Docker
22
22
  id: meta
23
- uses: docker/metadata-action@v4
23
+ uses: docker/metadata-action@v5
24
24
  with:
25
25
  images: lobehub/lobe-chat
26
26
  tags: |
@@ -28,13 +28,13 @@ jobs:
28
28
  type=ref,event=tag
29
29
 
30
30
  - name: Set up QEMU
31
- uses: docker/setup-qemu-action@v2
31
+ uses: docker/setup-qemu-action@v3
32
32
 
33
33
  - name: Set up Docker Buildx
34
- uses: docker/setup-buildx-action@v2
34
+ uses: docker/setup-buildx-action@v3
35
35
 
36
36
  - name: Build and push Docker image
37
- uses: docker/build-push-action@v4
37
+ uses: docker/build-push-action@v5
38
38
  with:
39
39
  context: .
40
40
  platforms: linux/amd64,linux/arm64
@@ -40,9 +40,7 @@ jobs:
40
40
  URLS: 'https://chat-preview.lobehub.com/settings'
41
41
  BADGES_ARGS: '-b pagespeed -o lighthouse/settings -r'
42
42
  COMMIT_MESSAGE: '🤖 chore: Lighthouse Results | Settings'
43
- ####################################################################
44
- # THAT'S IT; YOU DON'T HAVE TO DEFINE ANYTHING IN THE FOLLOWING
45
- ####################################################################
43
+
46
44
  steps:
47
45
  - name: Preparatory Tasks
48
46
  run: |
@@ -7,17 +7,18 @@ on:
7
7
 
8
8
  jobs:
9
9
  if_merged:
10
+ name: Check merged and add comment
10
11
  if: github.event.pull_request.merged == true
11
12
  runs-on: ubuntu-latest
12
13
  steps:
13
14
  - uses: actions-cool/pr-welcome@main
14
15
  with:
15
- token: ${{ secrets.GITHUB_TOKEN }}
16
+ token: ${{ secrets.GH_TOKEN }}
16
17
  comment: |
17
- 🎉 Great PR @${{ github.event.pull_request.user.login }} 🎉
18
+ ❤️ Great PR @${{ github.event.pull_request.user.login }} ❤️
18
19
 
19
- The growth of project is inseparable from user feedback and contribution, thanks for your contribution ❤️
20
+ The growth of project is inseparable from user feedback and contribution, thanks for your contribution!
20
21
 
21
- 项目的成长离不开用户反馈和贡献,感谢您的贡献 ❤️
22
+ 项目的成长离不开用户反馈和贡献,感谢您的贡献!
22
23
  emoji: 'hooray'
23
24
  pr-emoji: '+1, heart'
@@ -23,7 +23,7 @@ jobs:
23
23
  - name: Test
24
24
  run: bun run test
25
25
 
26
- - name: release
26
+ - name: Release
27
27
  run: bun run release
28
28
  env:
29
29
  GH_TOKEN: ${{ secrets.GH_TOKEN }}
@@ -17,11 +17,14 @@ jobs:
17
17
  if: ${{ github.event.repository.fork }}
18
18
 
19
19
  steps:
20
- # Step 1: run a standard checkout action
21
- - name: Checkout target repo
22
- uses: actions/checkout@v4
20
+ - uses: actions/checkout@v4
21
+
22
+ - name: Clean issue notice
23
+ uses: actions-cool/issues-helper@v3
24
+ with:
25
+ actions: 'close-issues'
26
+ labels: '🚨 Sync Fail'
23
27
 
24
- # Step 2: run the sync action
25
28
  - name: Sync upstream changes
26
29
  id: sync
27
30
  uses: aormsby/Fork-Sync-With-Upstream-action@v3.4
@@ -30,11 +33,8 @@ jobs:
30
33
  upstream_sync_branch: main
31
34
  target_sync_branch: main
32
35
  target_repo_token: ${{ secrets.GITHUB_TOKEN }} # automatically generated, no need to set
33
-
34
- # Set test_mode true to run tests instead of the true action!!
35
36
  test_mode: false
36
37
 
37
- # Step 3: run check
38
38
  - name: Sync check
39
39
  if: failure()
40
40
  uses: actions-cool/issues-helper@v3
@@ -13,7 +13,7 @@ jobs:
13
13
  - name: Install deps
14
14
  run: bun i
15
15
 
16
- - name: lint
16
+ - name: Lint
17
17
  run: bun run lint
18
18
 
19
19
  - name: Test and coverage
@@ -11,7 +11,7 @@ on:
11
11
  jobs:
12
12
  update-wiki:
13
13
  runs-on: ubuntu-latest
14
- name: wiki sync
14
+ name: Wiki sync
15
15
  steps:
16
16
  - uses: OrlovM/Wiki-Action@v1
17
17
  with:
package/CHANGELOG.md CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 0.86.4](https://github.com/lobehub/lobe-chat/compare/v0.86.3...v0.86.4)
6
+
7
+ <sup>Released on **2023-10-11**</sup>
8
+
9
+ #### 💄 Styles
10
+
11
+ - **misc**: Improve api key form.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Styles
19
+
20
+ - **misc**: Improve api key form ([fa3170d](https://github.com/lobehub/lobe-chat/commit/fa3170d))
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.86.3](https://github.com/lobehub/lobe-chat/compare/v0.86.2...v0.86.3)
31
+
32
+ <sup>Released on **2023-10-11**</sup>
33
+
34
+ #### 🐛 Bug Fixes
35
+
36
+ - **misc**: Fix docker image.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### What's fixed
44
+
45
+ - **misc**: Fix docker image ([14ff80e](https://github.com/lobehub/lobe-chat/commit/14ff80e))
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.86.2](https://github.com/lobehub/lobe-chat/compare/v0.86.1...v0.86.2)
6
56
 
7
57
  <sup>Released on **2023-10-11**</sup>
package/Dockerfile CHANGED
@@ -44,9 +44,10 @@ EXPOSE 3210
44
44
 
45
45
  # set hostname to localhost
46
46
  ENV HOSTNAME "0.0.0.0"
47
+ ENV PORT=3210
47
48
 
48
49
  ENV ACCESS_CODE "lobe66"
49
50
  ENV OPENAI_API_KEY ""
50
51
  ENV OPENAI_PROXY_URL ""
51
52
 
52
- CMD ["PORT=3210","node", "server.js"]
53
+ CMD ["node", "server.js"]
package/README.md CHANGED
@@ -15,11 +15,12 @@ LobeChat is a open-source, extensible ([Function Calling][fc-link]), high-perfor
15
15
  <!-- SHIELD GROUP -->
16
16
 
17
17
  [![][github-release-shield]][github-release-link]
18
+ [![][docker-release-shield]][docker-release-link]
18
19
  [![][vercel-shield]][vercel-link]
19
- [![][discord-shield]][discord-link]
20
- [![][github-releasedate-shield]][github-releasedate-link]
20
+ [![][discord-shield]][discord-link]<br/>
21
21
  [![][github-action-test-shield]][github-action-test-link]
22
- [![][github-action-release-shield]][github-action-release-link]<br/>
22
+ [![][github-action-release-shield]][github-action-release-link]
23
+ [![][github-releasedate-shield]][github-releasedate-link]<br/>
23
24
  [![][github-contributors-shield]][github-contributors-link]
24
25
  [![][github-forks-shield]][github-forks-link]
25
26
  [![][github-stars-shield]][github-stars-link]
@@ -189,11 +190,11 @@ LobeChat provides a [self-hosted version][deploy-link] with Vercel. This allows
189
190
  > **Note**\
190
191
  > This project provides some additional configuration items, set with environment variables, The complete list of environment variables can be found in the [📘 Environment Variables](https://github.com/lobehub/lobe-chat/wiki/Environment-Variable) :
191
192
 
192
- | Environment Variable | Required | Description | Example |
193
- | -------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
194
- | `OPENAI_API_KEY` | Yes | This is the API key you apply on the OpenAI account page | `sk-xxxxxx...xxxxxx` |
193
+ | Environment Variable | Required | Description | Example |
194
+ | -------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
195
+ | `OPENAI_API_KEY` | Yes | This is the API key you apply on the OpenAI account page | `sk-xxxxxx...xxxxxx` |
195
196
  | `OPENAI_PROXY_URL` | No | If you manually configure the OpenAI interface proxy, you can use this configuration item to override the default OpenAI API request base URL | `https://api.chatanywhere.cn/v1`<br/>The default value is<br/>`https://api.openai.com/v1` |
196
- | `ACCESS_CODE` | No | Add a password to access this service, the password should be a 6-digit number or letter | `awCT74` or `e3@09!` |
197
+ | `ACCESS_CODE` | No | Add a password to access this service, the password should be a 6-digit number or letter | `awCT74` or `e3@09!` |
197
198
 
198
199
  ### Keep Updated
199
200
 
@@ -333,6 +334,8 @@ This project is [MIT](./LICENSE) licensed.
333
334
  [discord-link]: https://discord.gg/AYFPHvv2jT
334
335
  [discord-shield]: https://img.shields.io/discord/1127171173982154893?color=5865F2&label=discord&labelColor=black&logo=discord&logoColor=white&style=flat-square
335
336
  [discord-shield-badge]: https://img.shields.io/discord/1127171173982154893?color=5865F2&label=discord&labelColor=black&logo=discord&logoColor=white&style=for-the-badge
337
+ [docker-release-link]: https://hub.docker.com/r/lobehub/lobe-chat
338
+ [docker-release-shield]: https://img.shields.io/docker/v/lobehub/lobe-chat?color=369eff&label=docker&labelColor=black&logo=docker&logoColor=white&style=flat-square
336
339
  [fc-link]: https://sspai.com/post/81986
337
340
  [fossa-license-link]: https://app.fossa.com/projects/git%2Bgithub.com%2Flobehub%2Flobe-chat
338
341
  [fossa-license-shield]: https://app.fossa.com/api/projects/git%2Bgithub.com%2Flobehub%2Flobe-chat.svg?type=large
package/README.zh-CN.md CHANGED
@@ -15,11 +15,12 @@ LobeChat 是一个开源的、可扩展的([Function Calling][fc-link])高
15
15
  <!-- SHIELD GROUP -->
16
16
 
17
17
  [![][github-release-shield]][github-release-link]
18
+ [![][docker-release-shield]][docker-release-link]
18
19
  [![][vercel-shield]][vercel-link]
19
- [![][discord-shield]][discord-link]
20
- [![][github-releasedate-shield]][github-releasedate-link]
20
+ [![][discord-shield]][discord-link]<br/>
21
21
  [![][github-action-test-shield]][github-action-test-link]
22
- [![][github-action-release-shield]][github-action-release-link]<br/>
22
+ [![][github-action-release-shield]][github-action-release-link]
23
+ [![][github-releasedate-shield]][github-releasedate-link]<br/>
23
24
  [![][github-contributors-shield]][github-contributors-link]
24
25
  [![][github-forks-shield]][github-forks-link]
25
26
  [![][github-stars-shield]][github-stars-link]
@@ -191,11 +192,11 @@ LobeChat 提供了 Vercel 的 [自托管版本][deploy-link]。这使你可以
191
192
  > **Note**\
192
193
  > 本项目提供了一些额外的配置项,使用环境变量进行设置,完整环境变量可见 [📘环境变量](https://github.com/lobehub/lobe-chat/wiki/Environment-Variable.zh-CN):
193
194
 
194
- | 环境变量 | 类型 | 描述 | 示例 |
195
- | ------------------ | ---- | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
196
- | `OPENAI_API_KEY` | 必选 | 这是你在 OpenAI 账户页面申请的 API 密钥 | `sk-xxxxxx...xxxxxx` |
195
+ | 环境变量 | 类型 | 描述 | 示例 |
196
+ | ------------------ | ---- | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
197
+ | `OPENAI_API_KEY` | 必选 | 这是你在 OpenAI 账户页面申请的 API 密钥 | `sk-xxxxxx...xxxxxx` |
197
198
  | `OPENAI_PROXY_URL` | 可选 | 如果你手动配置了 OpenAI 接口代理,可以使用此配置项来覆盖默认的 OpenAI API 请求基础 URL | `https://api.chatanywhere.cn/v1`<br/>默认值:<br/>`https://api.openai.com/v1` |
198
- | `ACCESS_CODE` | 可选 | 添加访问此服务的密码,密码应为 6 位数字或字母 | `awCT74` 或 `e3@09!` |
199
+ | `ACCESS_CODE` | 可选 | 添加访问此服务的密码,密码应为 6 位数字或字母 | `awCT74` 或 `e3@09!` |
199
200
 
200
201
  ### 保持更新
201
202
 
@@ -335,6 +336,8 @@ This project is [MIT](./LICENSE) licensed.
335
336
  [discord-link]: https://discord.gg/AYFPHvv2jT
336
337
  [discord-shield]: https://img.shields.io/discord/1127171173982154893?color=5865F2&label=discord&labelColor=black&logo=discord&logoColor=white&style=flat-square
337
338
  [discord-shield-badge]: https://img.shields.io/discord/1127171173982154893?color=5865F2&label=discord&labelColor=black&logo=discord&logoColor=white&style=for-the-badge
339
+ [docker-release-link]: https://hub.docker.com/r/lobehub/lobe-chat
340
+ [docker-release-shield]: https://img.shields.io/docker/v/lobehub/lobe-chat?color=369eff&label=docker&labelColor=black&logo=docker&logoColor=white&style=flat-square
338
341
  [fc-link]: https://sspai.com/post/81986
339
342
  [fossa-license-link]: https://app.fossa.com/projects/git%2Bgithub.com%2Flobehub%2Flobe-chat
340
343
  [fossa-license-shield]: https://app.fossa.com/api/projects/git%2Bgithub.com%2Flobehub%2Flobe-chat.svg?type=large
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.86.2",
3
+ "version": "0.86.4",
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",
@@ -1,5 +1,7 @@
1
+ import { Icon } from '@lobehub/ui';
1
2
  import { Button, Input } from 'antd';
2
- import { memo } from 'react';
3
+ import { Network } from 'lucide-react';
4
+ import { memo, useState } from 'react';
3
5
  import { useTranslation } from 'react-i18next';
4
6
  import { Center, Flexbox } from 'react-layout-kit';
5
7
 
@@ -10,11 +12,14 @@ import { FormAction } from './style';
10
12
 
11
13
  const APIKeyForm = memo<{ id: string }>(({ id }) => {
12
14
  const { t } = useTranslation('error');
15
+ const [showProxy, setShow] = useState(false);
13
16
 
14
- const [apiKey, setKeys] = useGlobalStore((s) => [
17
+ const [apiKey, proxyUrl, setConfig] = useGlobalStore((s) => [
15
18
  settingsSelectors.openAIAPI(s),
16
- s.setOpenAIAPIKey,
19
+ settingsSelectors.openAIProxyUrl(s),
20
+ s.setOpenAIConfig,
17
21
  ]);
22
+
18
23
  const [resend, deleteMessage] = useSessionStore((s) => [s.resendMessage, s.deleteMessage]);
19
24
 
20
25
  return (
@@ -26,12 +31,32 @@ const APIKeyForm = memo<{ id: string }>(({ id }) => {
26
31
  >
27
32
  <Input.Password
28
33
  onChange={(e) => {
29
- setKeys(e.target.value);
34
+ setConfig({ OPENAI_API_KEY: e.target.value });
30
35
  }}
31
36
  placeholder={'sk-*****************************************'}
32
37
  type={'block'}
33
38
  value={apiKey}
34
39
  />
40
+ {showProxy ? (
41
+ <Input
42
+ onChange={(e) => {
43
+ setConfig({ endpoint: e.target.value });
44
+ }}
45
+ placeholder={'https://api.openai.com/v1'}
46
+ type={'block'}
47
+ value={proxyUrl}
48
+ />
49
+ ) : (
50
+ <Button
51
+ icon={<Icon icon={Network} />}
52
+ onClick={() => {
53
+ setShow(true);
54
+ }}
55
+ type={'text'}
56
+ >
57
+ {t('unlock.apikey.addProxyUrl')}
58
+ </Button>
59
+ )}
35
60
  </FormAction>
36
61
  <Flexbox gap={12} width={'100%'}>
37
62
  <Button
@@ -29,12 +29,12 @@ const InvalidAccess = memo<{ id: string }>(({ id }) => {
29
29
  block
30
30
  onChange={(value) => setMode(value as Tab)}
31
31
  options={[
32
- { icon: <Icon icon={KeySquare} />, label: 'OpenAI API Key', value: Tab.Api },
33
32
  {
34
33
  icon: <Icon icon={SquareAsterisk} />,
35
34
  label: t('password', { ns: 'common' }),
36
35
  value: Tab.Password,
37
36
  },
37
+ { icon: <Icon icon={KeySquare} />, label: 'OpenAI API Key', value: Tab.Api },
38
38
  ]}
39
39
  style={{ width: '100%' }}
40
40
  value={mode}
@@ -37,6 +37,7 @@ export default {
37
37
  },
38
38
  unlock: {
39
39
  apikey: {
40
+ addProxyUrl: '添加 OpenAI 代理地址(可选)',
40
41
  description: '输入你的 OpenAI API Key 即可开始会话。应用不会记录你的 API Key',
41
42
  title: '使用自定义 API Key',
42
43
  },
@@ -17,6 +17,8 @@ const defaultAgentMeta = (s: GlobalStore) => merge(DEFAULT_AGENT_META, defaultAg
17
17
  const openAIAPIKeySelectors = (s: GlobalStore) =>
18
18
  s.settings.languageModel.openAI.OPENAI_API_KEY || s.settings.OPENAI_API_KEY;
19
19
 
20
+ const openAIProxyUrlSelectors = (s: GlobalStore) => s.settings.languageModel.openAI.endpoint;
21
+
20
22
  export const exportSettings = (s: GlobalStore) => {
21
23
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
22
24
  const { OPENAI_API_KEY: _, password: __, ...settings } = s.settings;
@@ -41,4 +43,5 @@ export const settingsSelectors = {
41
43
  defaultAgentMeta,
42
44
  exportSettings,
43
45
  openAIAPI: openAIAPIKeySelectors,
46
+ openAIProxyUrl: openAIProxyUrlSelectors,
44
47
  };
@@ -6,7 +6,7 @@ import type { StateCreator } from 'zustand/vanilla';
6
6
 
7
7
  import { DEFAULT_AGENT, DEFAULT_SETTINGS } from '@/const/settings';
8
8
  import { SettingsTabs } from '@/store/global/initialState';
9
- import type { GlobalSettings } from '@/types/settings';
9
+ import type { GlobalSettings, OpenAIConfig } from '@/types/settings';
10
10
  import { merge } from '@/utils/merge';
11
11
  import { setNamespace } from '@/utils/storeDebug';
12
12
 
@@ -23,7 +23,7 @@ export interface SettingsAction {
23
23
  * 重置设置
24
24
  */
25
25
  resetSettings: () => void;
26
- setOpenAIAPIKey: (apikey: string) => void;
26
+ setOpenAIConfig: (config: Partial<OpenAIConfig>) => void;
27
27
  /**
28
28
  * 设置部分配置设置
29
29
  * @param settings - 部分配置设置
@@ -63,17 +63,17 @@ export const createSettingsSlice: StateCreator<
63
63
  resetSettings: () => {
64
64
  set({ settings: DEFAULT_SETTINGS }, false, t('resetSettings'));
65
65
  },
66
- setOpenAIAPIKey: (apikey) => {
67
- get().setSettings({ languageModel: { openAI: { OPENAI_API_KEY: apikey } } });
66
+ setOpenAIConfig: (config) => {
67
+ get().setSettings({ languageModel: { openAI: config } });
68
68
  },
69
69
 
70
70
  setSettings: (settings) => {
71
- const oldSetting = get().settings;
72
- const nextSettings = merge(oldSetting, settings);
71
+ const prevSetting = get().settings;
72
+ const nextSettings = merge(prevSetting, settings);
73
73
 
74
- if (isEqual(oldSetting, nextSettings)) return;
74
+ if (isEqual(prevSetting, nextSettings)) return;
75
75
 
76
- set({ settings: merge(oldSetting, settings) }, false, t('setSettings', settings));
76
+ set({ settings: merge(prevSetting, settings) }, false, t('setSettings', settings));
77
77
  },
78
78
  switchSettingTabs: (tab) => {
79
79
  set({ settingsTab: tab });
@@ -45,7 +45,7 @@ export interface GlobalBaseSettings {
45
45
 
46
46
  export type GlobalDefaultAgent = Pick<LobeAgentSession, 'config' | 'meta'>;
47
47
 
48
- interface OpenAIConfig {
48
+ export interface OpenAIConfig {
49
49
  OPENAI_API_KEY: string;
50
50
  azureApiVersion?: string;
51
51
  endpoint?: string;
@@ -1,25 +0,0 @@
1
- name: Dependabot Auto Merge
2
- on:
3
- pull_request_target:
4
- types: [labeled, edited]
5
-
6
- jobs:
7
- merge:
8
- if: contains(github.event.pull_request.labels.*.name, 'dependencies')
9
- name: Dependabot Auto Merge
10
- runs-on: ubuntu-latest
11
- steps:
12
- - uses: actions/checkout@v4
13
-
14
- - name: Install bun
15
- uses: oven-sh/setup-bun@v1
16
-
17
- - name: Install deps
18
- run: bun i
19
-
20
- - name: Merge
21
- uses: ahmadnassri/action-dependabot-auto-merge@v2
22
- with:
23
- command: merge
24
- target: minor
25
- github-token: ${{ secrets.GH_TOKEN }}