From 9731b0d0500fdfd15cfa39594b6a6f2c0adf5fb6 Mon Sep 17 00:00:00 2001 From: Arvin Xu Date: Mon, 2 Dec 2024 13:37:05 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20perf:=20update=20agent?= =?UTF-8?q?=20index=20url=20(#4861)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * update agent index * fix test * improve url * fix test --- src/config/__tests__/app.test.ts | 4 ++-- src/config/app.ts | 9 +++++++-- src/server/modules/AssistantStore/index.test.ts | 8 ++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/config/__tests__/app.test.ts b/src/config/__tests__/app.test.ts index dc1d23475eb4..68e7cc33677e 100644 --- a/src/config/__tests__/app.test.ts +++ b/src/config/__tests__/app.test.ts @@ -24,7 +24,7 @@ describe('getServerConfig', () => { describe('index url', () => { it('should return default URLs when no environment variables are set', () => { const config = getAppConfig(); - expect(config.AGENTS_INDEX_URL).toBe('https://chat-agents.lobehub.com'); + expect(config.AGENTS_INDEX_URL).toBe('https://registry.npmmirror.com/@lobehub/agents-index/v1/files/public'); expect(config.PLUGINS_INDEX_URL).toBe('https://chat-plugins.lobehub.com'); }); @@ -41,7 +41,7 @@ describe('getServerConfig', () => { process.env.PLUGINS_INDEX_URL = ''; const config = getAppConfig(); - expect(config.AGENTS_INDEX_URL).toBe('https://chat-agents.lobehub.com'); + expect(config.AGENTS_INDEX_URL).toBe('https://registry.npmmirror.com/@lobehub/agents-index/v1/files/public'); expect(config.PLUGINS_INDEX_URL).toBe('https://chat-plugins.lobehub.com'); }); }); diff --git a/src/config/app.ts b/src/config/app.ts index 33ad1f0afab8..dd9ee235bf61 100644 --- a/src/config/app.ts +++ b/src/config/app.ts @@ -23,6 +23,11 @@ if (typeof window === 'undefined' && isServerMode && !APP_URL) { throw new Error('`APP_URL` is required in server mode'); } +const ASSISTANT_INDEX_URL = + 'https://registry.npmmirror.com/@lobehub/agents-index/v1/files/public'; + +const PLUGINS_INDEX_URL = 'https://chat-plugins.lobehub.com'; + export const getAppConfig = () => { const ACCESS_CODES = process.env.ACCESS_CODE?.split(',').filter(Boolean) || []; @@ -60,14 +65,14 @@ export const getAppConfig = () => { AGENTS_INDEX_URL: !!process.env.AGENTS_INDEX_URL ? process.env.AGENTS_INDEX_URL - : 'https://chat-agents.lobehub.com', + : ASSISTANT_INDEX_URL, DEFAULT_AGENT_CONFIG: process.env.DEFAULT_AGENT_CONFIG || '', SYSTEM_AGENT: process.env.SYSTEM_AGENT, PLUGINS_INDEX_URL: !!process.env.PLUGINS_INDEX_URL ? process.env.PLUGINS_INDEX_URL - : 'https://chat-plugins.lobehub.com', + : PLUGINS_INDEX_URL, PLUGIN_SETTINGS: process.env.PLUGIN_SETTINGS, diff --git a/src/server/modules/AssistantStore/index.test.ts b/src/server/modules/AssistantStore/index.test.ts index 975bb67190f8..fcde5c052d5c 100644 --- a/src/server/modules/AssistantStore/index.test.ts +++ b/src/server/modules/AssistantStore/index.test.ts @@ -3,7 +3,7 @@ import { describe, expect, it } from 'vitest'; import { AssistantStore } from './index'; -const baseURL = 'https://chat-agents.lobehub.com'; +const baseURL = 'https://registry.npmmirror.com/@lobehub/agents-index/v1/files/public'; describe('AssistantStore', () => { it('should return the default index URL when no language is provided', () => { const agentMarket = new AssistantStore(); @@ -14,19 +14,19 @@ describe('AssistantStore', () => { it('should return the index URL for a not supported language', () => { const agentMarket = new AssistantStore(); const url = agentMarket.getAgentIndexUrl('xxx' as any); - expect(url).toBe('https://chat-agents.lobehub.com'); + expect(url).toBe('https://registry.npmmirror.com/@lobehub/agents-index/v1/files/public'); }); it('should return the zh-CN URL for zh locale', () => { const agentMarket = new AssistantStore(); const url = agentMarket.getAgentIndexUrl('zh' as any); - expect(url).toBe('https://chat-agents.lobehub.com/index.zh-CN.json'); + expect(url).toBe('https://registry.npmmirror.com/@lobehub/agents-index/v1/files/public/index.zh-CN.json'); }); it('should return the default URL for en locale', () => { const agentMarket = new AssistantStore(); const url = agentMarket.getAgentIndexUrl('en' as any); - expect(url).toBe('https://chat-agents.lobehub.com'); + expect(url).toBe('https://registry.npmmirror.com/@lobehub/agents-index/v1/files/public'); }); it('should return the base URL if the provided language is not supported', () => { From 62d85851587be9df30f800a8db064ec36c50965f Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 2 Dec 2024 05:44:52 +0000 Subject: [PATCH 2/7] :bookmark: chore(release): v1.35.4 [skip ci] ### [Version 1.35.4](https://github.com/lobehub/lobe-chat/compare/v1.35.3...v1.35.4) Released on **2024-12-02**
Improvements and Fixes
[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
--- CHANGELOG.md | 17 +++++++++++++++++ package.json | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31396df696fd..fc9523f400dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,23 @@ # Changelog +### [Version 1.35.4](https://github.com/lobehub/lobe-chat/compare/v1.35.3...v1.35.4) + +Released on **2024-12-02** + +
+ +
+Improvements and Fixes + +
+ +
+ +[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top) + +
+ ### [Version 1.35.3](https://github.com/lobehub/lobe-chat/compare/v1.35.2...v1.35.3) Released on **2024-12-01** diff --git a/package.json b/package.json index fcdacdd693a4..870240e1d907 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lobehub/chat", - "version": "1.35.3", + "version": "1.35.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.", "keywords": [ "framework", From aa47cd8bc6b5de70bdec262dda092721f68f9fbd Mon Sep 17 00:00:00 2001 From: lobehubbot Date: Mon, 2 Dec 2024 05:45:47 +0000 Subject: [PATCH 3/7] =?UTF-8?q?=F0=9F=93=9D=20docs(bot):=20Auto=20sync=20a?= =?UTF-8?q?gents=20&=20plugin=20to=20readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 16 ++++++++-------- README.zh-CN.md | 4 ++-- changelog/v1.json | 5 +++++ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b2c6cffbd875..ab61c3646ccd 100644 --- a/README.md +++ b/README.md @@ -246,14 +246,14 @@ In addition, these plugins are not limited to news aggregation, but can also ext -| Recent Submits | Description | -| ---------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | -| [Tongyi wanxiang Image Generator](https://chat-preview.lobehub.com/settings/agent)
By **YoungTx** on **2024-08-09** | This plugin uses Alibaba's Tongyi Wanxiang model to generate images based on text prompts.
`image` `tongyi` `wanxiang` | -| [Shopping tools](https://chat-preview.lobehub.com/settings/agent)
By **shoppingtools** on **2024-07-19** | Search for products on eBay & AliExpress, find eBay events & coupons. Get prompt examples.
`shopping` `e-bay` `ali-express` `coupons` | -| [Savvy Trader AI](https://chat-preview.lobehub.com/settings/agent)
By **savvytrader** on **2024-06-27** | Realtime stock, crypto and other investment data.
`stock` `analyze` | -| [Search1API](https://chat-preview.lobehub.com/settings/agent)
By **fatwang2** on **2024-05-06** | Search aggregation service, specifically designed for LLMs
`web` `search` | - -> 📊 Total plugins: [**49**](https://github.com/lobehub/lobe-chat-plugins) +| Recent Submits | Description | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| [Google CSE](https://chat-preview.lobehub.com/settings/agent)
By **vsnthdev** on **2024-12-02** | Searches Google through their official CSE API.
`web` `search` | +| [Google CSE](https://chat-preview.lobehub.com/settings/agent)
By **vsnthdev** on **2024-12-02** | Searches Google through their official CSE API.
`web` `search` | +| [Speak](https://chat-preview.lobehub.com/settings/agent)
By **speak** on **2024-12-02** | Learn how to say anything in another language with Speak, your AI-powered language tutor.
`education` `language` | +| [Speak](https://chat-preview.lobehub.com/settings/agent)
By **speak** on **2024-12-02** | Learn how to say anything in another language with Speak, your AI-powered language tutor.
`education` `language` | + +> 📊 Total plugins: [**98**](https://github.com/lobehub/lobe-chat-plugins) diff --git a/README.zh-CN.md b/README.zh-CN.md index 0e4ae0483d12..b2e7736c609d 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -241,10 +241,10 @@ LobeChat 的插件生态系统是其核心功能的重要扩展,它极大地 | 最近新增 | 插件描述 | | ---------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | +| [谷歌自定义搜索引擎](https://chat-preview.lobehub.com/settings/agent)
By **vsnthdev** on **2024-12-02** | 通过他们的官方自定义搜索引擎 API 搜索谷歌。
`网络` `搜索` | +| [Speak](https://chat-preview.lobehub.com/settings/agent)
By **speak** on **2024-12-02** | 使用 Speak,您的 AI 语言导师,学习如何用另一种语言说任何事情。
`教育` `语言` | | [通义万象图像生成器](https://chat-preview.lobehub.com/settings/agent)
By **YoungTx** on **2024-08-09** | 此插件使用阿里巴巴的通义万象模型根据文本提示生成图像。
`图像` `通义` `万象` | | [购物工具](https://chat-preview.lobehub.com/settings/agent)
By **shoppingtools** on **2024-07-19** | 在 eBay 和 AliExpress 上搜索产品,查找 eBay 活动和优惠券。获取快速示例。
`购物` `e-bay` `ali-express` `优惠券` | -| [Savvy Trader AI](https://chat-preview.lobehub.com/settings/agent)
By **savvytrader** on **2024-06-27** | 实时股票、加密货币和其他投资数据。
`股票` `分析` | -| [Search1API](https://chat-preview.lobehub.com/settings/agent)
By **fatwang2** on **2024-05-06** | 搜索聚合服务,专为 LLMs 设计
`web` `search` | > 📊 Total plugins: [**49**](https://github.com/lobehub/lobe-chat-plugins) diff --git a/changelog/v1.json b/changelog/v1.json index cc4b23d3ea62..1034f7f3ed15 100644 --- a/changelog/v1.json +++ b/changelog/v1.json @@ -1,4 +1,9 @@ [ + { + "children": {}, + "date": "2024-12-02", + "version": "1.35.4" + }, { "children": { "improvements": ["Add gpt-4o-2024-11-20 model."] From e290230040910bb8b110c46db83abce38f1692a8 Mon Sep 17 00:00:00 2001 From: TC <34400653+tcmonster@users.noreply.github.com> Date: Mon, 2 Dec 2024 16:25:48 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=F0=9F=93=9D=20docs:=20update=20provider=20?= =?UTF-8?q?docs=20(#4865)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 📝 docs: update docs for providers * 📝 docs: update provider doc * docs: add doc for cloudflare * 📝 docs: update provider docs --------- Co-authored-by: GH Action - Upstream Sync --- docs/usage/providers/giteeai.mdx | 79 ++++++++++++++++++++++++ docs/usage/providers/giteeai.zh-CN.mdx | 75 ++++++++++++++++++++++ docs/usage/providers/internlm.mdx | 70 +++++++++++++++++++++ docs/usage/providers/internlm.zh-CN.mdx | 66 ++++++++++++++++++++ docs/usage/providers/sensenova.mdx | 79 ++++++++++++++++++++++++ docs/usage/providers/sensenova.zh-CN.mdx | 75 ++++++++++++++++++++++ docs/usage/providers/xai.mdx | 70 +++++++++++++++++++++ docs/usage/providers/xai.zh-CN.mdx | 66 ++++++++++++++++++++ 8 files changed, 580 insertions(+) create mode 100644 docs/usage/providers/giteeai.mdx create mode 100644 docs/usage/providers/giteeai.zh-CN.mdx create mode 100644 docs/usage/providers/internlm.mdx create mode 100644 docs/usage/providers/internlm.zh-CN.mdx create mode 100644 docs/usage/providers/sensenova.mdx create mode 100644 docs/usage/providers/sensenova.zh-CN.mdx create mode 100644 docs/usage/providers/xai.mdx create mode 100644 docs/usage/providers/xai.zh-CN.mdx diff --git a/docs/usage/providers/giteeai.mdx b/docs/usage/providers/giteeai.mdx new file mode 100644 index 000000000000..2379b4e97443 --- /dev/null +++ b/docs/usage/providers/giteeai.mdx @@ -0,0 +1,79 @@ +--- +title: Using Gitee AI in LobeChat +description: >- + Learn how to configure and use Gitee AI's API Key in LobeChat to start + conversations and interactions. +tags: + - LobeChat + - Gitee AI + - API Key + - Web UI +--- + +# Using Gitee AI in LobeChat + + + +[Gitee AI](https://ai.gitee.com/) is an open-source platform based on Git code hosting technology, specifically designed for AI application scenarios. It aims to provide developers and businesses with a one-stop solution for AI application development services, including model experience, inference, fine-tuning, and deployment. + +This article will guide you on how to use Gitee AI in LobeChat. + + + +### Step 1: Obtain the Gitee AI API Key + +- Register and log in to the [Gitee AI official website](https://ai.gitee.com/) +- Purchase and recharge `Serverless API` from your dashboard + +{'Gitee + +- In `Settings`, click on the `Access Tokens` section +- Create a new access token +- Save the access token in the pop-up window + +{'Gitee + + + Please keep the access token safe as it will only appear once. If you accidentally lose it, you + will need to create a new one. + + +### Step 2: Configure Gitee AI in LobeChat + +- Access the `Settings` page in LobeChat +- Under `Language Models`, find the settings for `Gitee AI` + +{'Enter + +- Enter the obtained API key +- Select a Gitee AI model for your AI assistant to begin chatting + +{'Select + + + During usage, you may need to make payments to the API service provider; please refer to Gitee + AI's relevant pricing policy. + + + + +Now you can start having conversations using the models provided by Gitee AI in LobeChat! diff --git a/docs/usage/providers/giteeai.zh-CN.mdx b/docs/usage/providers/giteeai.zh-CN.mdx new file mode 100644 index 000000000000..6008bb2bde7d --- /dev/null +++ b/docs/usage/providers/giteeai.zh-CN.mdx @@ -0,0 +1,75 @@ +--- +title: 在 LobeChat 中使用 Gitee AI +description: 学习如何在 LobeChat 中配置和使用 Gitee AI 的 API Key,以便开始对话和交互。 +tags: + - LobeChat + - Gitee AI + - API密钥 + - Web UI +--- + +# 在 LobeChat 中使用 Gitee AI + + + +[Gitee AI](https://ai.gitee.com/) 是一个基于 Git 代码托管技术的开源平台,专为人工智能(AI)应用场景设计。它旨在为开发者和企业提供一站式的 AI 应用开发服务,包括模型体验、推理、微调和部署等功能。 + +本文将指导你如何在 LobeChat 中使用 Gitee AI。 + + + +### 步骤一: 获取 Gitee AI 的 API 密钥 + +- 注册并登录 [Gitee AI 官网](https://ai.gitee.com/) +- 在工作台中购买并充值 `Serverless API` + +{'Gitee + +- 在 `设置` 中点击 `访问令牌` 界面 +- 创建一个新的访问令牌 +- 在弹出窗口中保存访问令牌 + +{'Gitee + + + 妥善保存弹窗中的访问令牌,它只会出现一次,如果不小心丢失了,你需要重新创建一个访问令牌。 + + +### 步骤二:在 LobeChat 中配置 Gitee AI + +- 访问 LobeChat 的`设置`界面 +- 在`语言模型`下找到 `Gitee AI` 的设置项 + +{'填入 + +- 填入获得的 API 密钥 +- 为你的 AI 助手选择一个 Gitee AI 的模型即可开始对话 + +{'选择 + + + 在使用过程中你可能需要向 API 服务提供商付费,请参考 Gitee AI 的相关费用政策。 + + + + +至此你已经可以在 LobeChat 中使用 Gitee AI 提供的模型进行对话了。 diff --git a/docs/usage/providers/internlm.mdx b/docs/usage/providers/internlm.mdx new file mode 100644 index 000000000000..a23a813ea408 --- /dev/null +++ b/docs/usage/providers/internlm.mdx @@ -0,0 +1,70 @@ +--- +title: Using InternLM in LobeChat +description: >- + Learn how to configure and use SenseNova's API Key in LobeChat to start + conversations and interactions. +tags: + - LobeChat + - InternLM + - API Key + - Web UI +--- + +# Using InternLM in LobeChat + + + +[InternLM](https://platform.sensenova.cn/home) is a large pre-trained language model jointly launched by the Shanghai Artificial Intelligence Laboratory and Shusheng Group. This model focuses on natural language processing, aimed at understanding and generating human language, boasting powerful semantic comprehension and text generation capabilities. + +This article will guide you on how to use InternLM in LobeChat. + + + +### Step 1: Obtain the InternLM API Key + +- Register and log in to [InternLM API](https://InternLM.intern-ai.org.cn/api/tokens) +- Create an API token +- Save the API token in the pop-up window + +{'Save + + + Please store the API token shown in the pop-up securely; it will only appear once. If you lose it, + you will need to create a new API token. + + +### Step 2: Configure InternLM in LobeChat + +- Go to the `Settings` interface in LobeChat +- Find the settings option for `InternLM` under `Language Models` + +{'Enter + +- Enter the obtained `AccessKey ID` and `AccessKey Secret` +- Choose a InternLM model for your AI assistant to start a conversation + +{'Select + + + During usage, you may need to pay the API service provider; please refer to the pricing policy + regarding InternLM. + + + + +You are now ready to engage in conversations using the models provided by InternLM in LobeChat. diff --git a/docs/usage/providers/internlm.zh-CN.mdx b/docs/usage/providers/internlm.zh-CN.mdx new file mode 100644 index 000000000000..cb73168196ce --- /dev/null +++ b/docs/usage/providers/internlm.zh-CN.mdx @@ -0,0 +1,66 @@ +--- +title: 在 LobeChat 中使用书生浦语 +description: 学习如何在 LobeChat 中配置和使用书生浦语的 API Key,以便开始对话和交互。 +tags: + - LobeChat + - 书生浦语 + - API密钥 + - Web UI +--- + +# 在 LobeChat 中使用书生浦语 + + + +[书生浦语(InternLM)](https://platform.sensenova.cn/home) 是由上海人工智能实验室与书生集团联合推出的一款大型预训练语言模型。该模型专注于自然语言处理,旨在理解和生成自然语言,具备强大的语义理解和文本生成能力。 + +本文将指导你如何在 LobeChat 中使用书生浦语。 + + + +### 步骤一: 获取书生浦语的 API 密钥 + +- 注册并登录 [浦语 API](https://internlm.intern-ai.org.cn/api/tokens) +- 创建一个 API 令牌 +- 在弹出窗口中保存 API 令牌 + +{'保存 + + + 妥善保存弹窗中的 API 令牌,它只会出现一次,如果不小心丢失了,你需要重新创建一个 API 令牌。 + + +### 步骤二:在 LobeChat 中配置书生浦语 + +- 访问 LobeChat 的`设置`界面 +- 在`语言模型`下找到 `书生浦语` 的设置项 + +{'填入 + +- 填入获得的 `AccessKey ID` 和 `AccessKey Secret` +- 为你的 AI 助手选择一个书生浦语的模型即可开始对话 + +{'选择书生浦语模型并开始对话'} + + + 在使用过程中你可能需要向 API 服务提供商付费,请参考书生浦语的相关费用政策。 + + + + +至此你已经可以在 LobeChat 中使用书生浦语提供的模型进行对话了。 diff --git a/docs/usage/providers/sensenova.mdx b/docs/usage/providers/sensenova.mdx new file mode 100644 index 000000000000..e66d6d63fdb4 --- /dev/null +++ b/docs/usage/providers/sensenova.mdx @@ -0,0 +1,79 @@ +--- +title: Using SenseNova in LobeChat +description: >- + Learn how to configure and use SenseNova's API Key in LobeChat to start + conversations and interactions. +tags: + - LobeChat + - SenseNova + - API Key + - Web UI +--- + +# Using SenseNova in LobeChat + + + +[SenseNova](https://platform.sensenova.cn/home) is a large model system introduced by SenseTime, aimed at promoting the rapid iteration and practical application of artificial intelligence (AI) technology. + +This article will guide you on how to use SenseNova in LobeChat. + + + +### Step 1: Obtain the API Key for SenseNova + +- Register and log in to the [SenseCore Development Platform](https://www.sensecore.cn/product/aistudio). +- Locate the `SenseNova Large Model` in the product menu and activate the service. + +{'Activate + +- Go to the [AccessKey Management](https://console.sensecore.cn/iam/Security/access-key) page. +- Create an access key. +- Save the Access Key ID and secret in the pop-up window. + +{'Save + + + Please keep the access key from the pop-up window secure, as it will only appear once. If you lose + it, you will need to create a new access key. + + +### Step 2: Configure SenseNova in LobeChat + +- Access the `Settings` interface on LobeChat. +- Find the setting for `SenseNova` under `Language Models`. + +{'Enter + +- Input the obtained `Access Key ID` and `Access Key Secret`. +- Choose a SenseNova model for your AI assistant and start the conversation. + +{'Choose + + + During usage, you may need to pay the API service provider, please refer to the relevant fee + policy for SenseNova. + + + + +You can now have conversations using the models provided by SenseNova in LobeChat. diff --git a/docs/usage/providers/sensenova.zh-CN.mdx b/docs/usage/providers/sensenova.zh-CN.mdx new file mode 100644 index 000000000000..454fdf40aaff --- /dev/null +++ b/docs/usage/providers/sensenova.zh-CN.mdx @@ -0,0 +1,75 @@ +--- +title: 在 LobeChat 中使用商汤日日新 +description: 学习如何在 LobeChat 中配置和使用商汤日日新的 API Key,以便开始对话和交互。 +tags: + - LobeChat + - 商汤日日新 + - API密钥 + - Web UI +--- + +# 在 LobeChat 中使用商汤日日新 + + + +[商汤日日新](https://platform.sensenova.cn/home) 是商汤科技(SenseTime)推出的一个大模型体系,旨在推动人工智能(AI)技术的快速迭代和应用落地。 + +本文将指导你如何在 LobeChat 中使用商汤日日新。 + + + +### 步骤一: 获取商汤日日新的 API 密钥 + +- 注册并登录 [万象模型开发平台](https://www.sensecore.cn/product/aistudio) +- 在产品菜单中找到 `日日新大模型` 并开通服务 + +{'开通日日新大模型'} + +- 进入 [AccessKey 访问密钥](https://console.sensecore.cn/iam/Security/access-key) 页面 +- 创建一个访问密钥 +- 在弹出窗口中保存访问密钥 ID 和令牌 + +{'保存访问密钥'} + + + 妥善保存弹窗中的访问密钥,它只会出现一次,如果不小心丢失了,你需要重新创建一个访问密钥。 + + +### 步骤二:在 LobeChat 中配置商汤日日新 + +- 访问 LobeChat 的`设置`界面 +- 在`语言模型`下找到 `商汤日日新` 的设置项 + +{'填入访问密钥'} + +- 填入获得的 `AccessKey ID` 和 `AccessKey Secret` +- 为你的 AI 助手选择一个商汤日日新的模型即可开始对话 + +{'选择商汤日日新模型并开始对话'} + + + 在使用过程中你可能需要向 API 服务提供商付费,请参考商汤日日新的相关费用政策。 + + + + +至此你已经可以在 LobeChat 中使用商汤日日新提供的模型进行对话了。 diff --git a/docs/usage/providers/xai.mdx b/docs/usage/providers/xai.mdx new file mode 100644 index 000000000000..9630e33d4415 --- /dev/null +++ b/docs/usage/providers/xai.mdx @@ -0,0 +1,70 @@ +--- +title: Using xAI in LobeChat +description: >- + Learn how to configure and use xAI's API Key in LobeChat to start + conversations and interactions. +tags: + - LobeChat + - xAI + - API Key + - Web UI +--- + +# Using xAI in LobeChat + + + +[xAI](https://x.ai/) is an artificial intelligence company founded by Elon Musk in 2023, aimed at exploring and understanding the true nature of the universe. The company's mission is to solve complex scientific and mathematical problems using AI technology and to advance the field of artificial intelligence. + +This article will guide you on how to use xAI in LobeChat. + + + +### Step 1: Obtain an API Key from xAI + +- Register and login to the [xAI console](https://console.x.ai/) +- Create an API token +- Copy and save the API token + +{'xAI + + + Make sure to securely save the API token displayed in the popup; it only appears once. If you + accidentally lose it, you will need to create a new API token. + + +### Step 2: Configure xAI in LobeChat + +- Go to the `Settings` menu in LobeChat +- Locate the `xAI` settings under `Language Model` + +{'Enter + +- Enter the API key you obtained +- Select an xAI model for your AI assistant to start a conversation + +{'Select + + + During use, you may need to pay the API service provider, so please refer to xAI's relevant + pricing policies. + + + + +You are now ready to engage in conversations using the models provided by xAI in LobeChat. diff --git a/docs/usage/providers/xai.zh-CN.mdx b/docs/usage/providers/xai.zh-CN.mdx new file mode 100644 index 000000000000..3470984a9bad --- /dev/null +++ b/docs/usage/providers/xai.zh-CN.mdx @@ -0,0 +1,66 @@ +--- +title: 在 LobeChat 中使用 xAI +description: 学习如何在 LobeChat 中配置和使用 xAI 的 API Key,以便开始对话和交互。 +tags: + - LobeChat + - xAI + - API密钥 + - Web UI +--- + +# 在 LobeChat 中使用 xAI + + + +[xAI](https://x.ai/) 是由埃隆·马斯克于2023年成立的一家人工智能公司,旨在探索和理解宇宙的真实本质。该公司的目标是通过人工智能技术解决复杂的科学和数学问题,并推动人工智能的发展。 + +本文将指导你如何在 LobeChat 中使用 xAI。 + + + +### 步骤一: 获取 xAI 的 API 密钥 + +- 注册并登录 [xAI 控制台](https://console.x.ai/) +- 创建一个 API Token +- 复制并保存 API Token + +{'xAI + + + 妥善保存弹窗中的 API 令牌,它只会出现一次,如果不小心丢失了,你需要重新创建一个 API 令牌。 + + +### 步骤二:在 LobeChat 中配置 xAI + +- 访问 LobeChat 的`设置`界面 +- 在`语言模型`下找到 `xAI` 的设置项 + +{'填入 + +- 填入获得的 API 密钥 +- 为你的 AI 助手选择一个 xAI 的模型即可开始对话 + +{'选择 + + + 在使用过程中你可能需要向 API 服务提供商付费,请参考 xAI 的相关费用政策。 + + + + +至此你已经可以在 LobeChat 中使用 xAI 提供的模型进行对话了。 From 7dff4585637fefe07b11ad69d3d38487eb27570d Mon Sep 17 00:00:00 2001 From: Arvin Xu Date: Mon, 2 Dec 2024 19:39:36 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20deprecated?= =?UTF-8?q?=20the=20current=20client=20mode=20code=20(#4866)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/__tests__/db-upgrade.test.ts | 0 .../{client => _deprecated}/core/__tests__/db.test.ts | 0 .../{client => _deprecated}/core/__tests__/model.test.ts | 0 src/database/{client => _deprecated}/core/db.ts | 0 src/database/{client => _deprecated}/core/index.ts | 0 .../migrations/migrateSettingsToUser/fixtures/input.json | 0 .../migrations/migrateSettingsToUser/fixtures/output.json | 0 .../core/migrations/migrateSettingsToUser/index.test.ts | 0 .../core/migrations/migrateSettingsToUser/index.ts | 0 .../core/migrations/migrateSettingsToUser/type.ts | 0 src/database/{client => _deprecated}/core/model.ts | 0 src/database/{client => _deprecated}/core/schemas.ts | 0 src/database/{client => _deprecated}/core/sync.ts | 0 src/database/{client => _deprecated}/core/types/db.ts | 0 src/database/{client => _deprecated}/models/__DEBUG.ts | 6 +++--- .../{client => _deprecated}/models/__tests__/file.test.ts | 0 .../models/__tests__/message.test.ts | 0 .../models/__tests__/plugin.test.ts | 0 .../models/__tests__/session.test.ts | 6 +++--- .../models/__tests__/sessionGroup.test.ts | 2 +- .../models/__tests__/topic.test.ts | 8 ++++---- .../{client => _deprecated}/models/__tests__/user.test.ts | 0 src/database/{client => _deprecated}/models/file.ts | 4 ++-- src/database/{client => _deprecated}/models/message.ts | 6 +++--- src/database/{client => _deprecated}/models/plugin.ts | 2 +- src/database/{client => _deprecated}/models/session.ts | 6 +++--- .../{client => _deprecated}/models/sessionGroup.ts | 4 ++-- src/database/{client => _deprecated}/models/topic.ts | 8 ++++---- src/database/{client => _deprecated}/models/user.ts | 2 +- src/database/{client => _deprecated}/schemas/files.ts | 0 src/database/{client => _deprecated}/schemas/message.ts | 0 src/database/{client => _deprecated}/schemas/plugin.ts | 0 src/database/{client => _deprecated}/schemas/session.ts | 0 .../{client => _deprecated}/schemas/sessionGroup.ts | 0 src/database/{client => _deprecated}/schemas/topic.ts | 0 src/database/{client => _deprecated}/schemas/user.ts | 2 +- src/services/__tests__/sync.test.ts | 4 ++-- src/services/debug.ts | 2 +- src/services/file/client.test.ts | 6 +++--- src/services/file/client.ts | 4 ++-- src/services/import/client.ts | 8 ++++---- src/services/message/client.test.ts | 4 ++-- src/services/message/client.ts | 6 +++--- src/services/message/index.test.ts | 4 ++-- src/services/message/type.ts | 2 +- src/services/plugin/client.test.ts | 6 +++--- src/services/plugin/client.ts | 2 +- src/services/session/client.test.ts | 8 ++++---- src/services/session/client.ts | 6 +++--- src/services/sync.ts | 2 +- src/services/topic/client.test.ts | 6 +++--- src/services/topic/client.ts | 2 +- src/services/upload.ts | 2 +- src/services/user/client.test.ts | 4 ++-- src/services/user/client.ts | 6 +++--- src/store/file/slices/chat/action.test.ts | 2 +- src/types/sync.ts | 2 +- 57 files changed, 72 insertions(+), 72 deletions(-) rename src/database/{client => _deprecated}/core/__tests__/db-upgrade.test.ts (100%) rename src/database/{client => _deprecated}/core/__tests__/db.test.ts (100%) rename src/database/{client => _deprecated}/core/__tests__/model.test.ts (100%) rename src/database/{client => _deprecated}/core/db.ts (100%) rename src/database/{client => _deprecated}/core/index.ts (100%) rename src/database/{client => _deprecated}/core/migrations/migrateSettingsToUser/fixtures/input.json (100%) rename src/database/{client => _deprecated}/core/migrations/migrateSettingsToUser/fixtures/output.json (100%) rename src/database/{client => _deprecated}/core/migrations/migrateSettingsToUser/index.test.ts (100%) rename src/database/{client => _deprecated}/core/migrations/migrateSettingsToUser/index.ts (100%) rename src/database/{client => _deprecated}/core/migrations/migrateSettingsToUser/type.ts (100%) rename src/database/{client => _deprecated}/core/model.ts (100%) rename src/database/{client => _deprecated}/core/schemas.ts (100%) rename src/database/{client => _deprecated}/core/sync.ts (100%) rename src/database/{client => _deprecated}/core/types/db.ts (100%) rename src/database/{client => _deprecated}/models/__DEBUG.ts (95%) rename src/database/{client => _deprecated}/models/__tests__/file.test.ts (100%) rename src/database/{client => _deprecated}/models/__tests__/message.test.ts (100%) rename src/database/{client => _deprecated}/models/__tests__/plugin.test.ts (100%) rename src/database/{client => _deprecated}/models/__tests__/session.test.ts (97%) rename src/database/{client => _deprecated}/models/__tests__/sessionGroup.test.ts (99%) rename src/database/{client => _deprecated}/models/__tests__/topic.test.ts (98%) rename src/database/{client => _deprecated}/models/__tests__/user.test.ts (100%) rename src/database/{client => _deprecated}/models/file.ts (84%) rename src/database/{client => _deprecated}/models/message.ts (97%) rename src/database/{client => _deprecated}/models/plugin.ts (96%) rename src/database/{client => _deprecated}/models/session.ts (97%) rename src/database/{client => _deprecated}/models/sessionGroup.ts (96%) rename src/database/{client => _deprecated}/models/topic.ts (96%) rename src/database/{client => _deprecated}/models/user.ts (96%) rename src/database/{client => _deprecated}/schemas/files.ts (100%) rename src/database/{client => _deprecated}/schemas/message.ts (100%) rename src/database/{client => _deprecated}/schemas/plugin.ts (100%) rename src/database/{client => _deprecated}/schemas/session.ts (100%) rename src/database/{client => _deprecated}/schemas/sessionGroup.ts (100%) rename src/database/{client => _deprecated}/schemas/topic.ts (100%) rename src/database/{client => _deprecated}/schemas/user.ts (92%) diff --git a/src/database/client/core/__tests__/db-upgrade.test.ts b/src/database/_deprecated/core/__tests__/db-upgrade.test.ts similarity index 100% rename from src/database/client/core/__tests__/db-upgrade.test.ts rename to src/database/_deprecated/core/__tests__/db-upgrade.test.ts diff --git a/src/database/client/core/__tests__/db.test.ts b/src/database/_deprecated/core/__tests__/db.test.ts similarity index 100% rename from src/database/client/core/__tests__/db.test.ts rename to src/database/_deprecated/core/__tests__/db.test.ts diff --git a/src/database/client/core/__tests__/model.test.ts b/src/database/_deprecated/core/__tests__/model.test.ts similarity index 100% rename from src/database/client/core/__tests__/model.test.ts rename to src/database/_deprecated/core/__tests__/model.test.ts diff --git a/src/database/client/core/db.ts b/src/database/_deprecated/core/db.ts similarity index 100% rename from src/database/client/core/db.ts rename to src/database/_deprecated/core/db.ts diff --git a/src/database/client/core/index.ts b/src/database/_deprecated/core/index.ts similarity index 100% rename from src/database/client/core/index.ts rename to src/database/_deprecated/core/index.ts diff --git a/src/database/client/core/migrations/migrateSettingsToUser/fixtures/input.json b/src/database/_deprecated/core/migrations/migrateSettingsToUser/fixtures/input.json similarity index 100% rename from src/database/client/core/migrations/migrateSettingsToUser/fixtures/input.json rename to src/database/_deprecated/core/migrations/migrateSettingsToUser/fixtures/input.json diff --git a/src/database/client/core/migrations/migrateSettingsToUser/fixtures/output.json b/src/database/_deprecated/core/migrations/migrateSettingsToUser/fixtures/output.json similarity index 100% rename from src/database/client/core/migrations/migrateSettingsToUser/fixtures/output.json rename to src/database/_deprecated/core/migrations/migrateSettingsToUser/fixtures/output.json diff --git a/src/database/client/core/migrations/migrateSettingsToUser/index.test.ts b/src/database/_deprecated/core/migrations/migrateSettingsToUser/index.test.ts similarity index 100% rename from src/database/client/core/migrations/migrateSettingsToUser/index.test.ts rename to src/database/_deprecated/core/migrations/migrateSettingsToUser/index.test.ts diff --git a/src/database/client/core/migrations/migrateSettingsToUser/index.ts b/src/database/_deprecated/core/migrations/migrateSettingsToUser/index.ts similarity index 100% rename from src/database/client/core/migrations/migrateSettingsToUser/index.ts rename to src/database/_deprecated/core/migrations/migrateSettingsToUser/index.ts diff --git a/src/database/client/core/migrations/migrateSettingsToUser/type.ts b/src/database/_deprecated/core/migrations/migrateSettingsToUser/type.ts similarity index 100% rename from src/database/client/core/migrations/migrateSettingsToUser/type.ts rename to src/database/_deprecated/core/migrations/migrateSettingsToUser/type.ts diff --git a/src/database/client/core/model.ts b/src/database/_deprecated/core/model.ts similarity index 100% rename from src/database/client/core/model.ts rename to src/database/_deprecated/core/model.ts diff --git a/src/database/client/core/schemas.ts b/src/database/_deprecated/core/schemas.ts similarity index 100% rename from src/database/client/core/schemas.ts rename to src/database/_deprecated/core/schemas.ts diff --git a/src/database/client/core/sync.ts b/src/database/_deprecated/core/sync.ts similarity index 100% rename from src/database/client/core/sync.ts rename to src/database/_deprecated/core/sync.ts diff --git a/src/database/client/core/types/db.ts b/src/database/_deprecated/core/types/db.ts similarity index 100% rename from src/database/client/core/types/db.ts rename to src/database/_deprecated/core/types/db.ts diff --git a/src/database/client/models/__DEBUG.ts b/src/database/_deprecated/models/__DEBUG.ts similarity index 95% rename from src/database/client/models/__DEBUG.ts rename to src/database/_deprecated/models/__DEBUG.ts index 890474120573..19951870dfa4 100644 --- a/src/database/client/models/__DEBUG.ts +++ b/src/database/_deprecated/models/__DEBUG.ts @@ -1,9 +1,9 @@ // This file is for debugging purposes only. // DON'T USE IT IN PRODUCTION. import { DEFAULT_AGENT_CONFIG } from '@/const/settings'; -import { DBModel } from '@/database/client/core/types/db'; -import { DB_Message } from '@/database/client/schemas/message'; -import { DB_Topic } from '@/database/client/schemas/topic'; +import { DBModel } from '@/database/_deprecated/core/types/db'; +import { DB_Message } from '@/database/_deprecated/schemas/message'; +import { DB_Topic } from '@/database/_deprecated/schemas/topic'; import { BaseModel } from '../core'; import { DB_Session, DB_SessionSchema } from '../schemas/session'; diff --git a/src/database/client/models/__tests__/file.test.ts b/src/database/_deprecated/models/__tests__/file.test.ts similarity index 100% rename from src/database/client/models/__tests__/file.test.ts rename to src/database/_deprecated/models/__tests__/file.test.ts diff --git a/src/database/client/models/__tests__/message.test.ts b/src/database/_deprecated/models/__tests__/message.test.ts similarity index 100% rename from src/database/client/models/__tests__/message.test.ts rename to src/database/_deprecated/models/__tests__/message.test.ts diff --git a/src/database/client/models/__tests__/plugin.test.ts b/src/database/_deprecated/models/__tests__/plugin.test.ts similarity index 100% rename from src/database/client/models/__tests__/plugin.test.ts rename to src/database/_deprecated/models/__tests__/plugin.test.ts diff --git a/src/database/client/models/__tests__/session.test.ts b/src/database/_deprecated/models/__tests__/session.test.ts similarity index 97% rename from src/database/client/models/__tests__/session.test.ts rename to src/database/_deprecated/models/__tests__/session.test.ts index 6252f42048e5..e34de5549308 100644 --- a/src/database/client/models/__tests__/session.test.ts +++ b/src/database/_deprecated/models/__tests__/session.test.ts @@ -1,9 +1,9 @@ import { afterEach, beforeEach, describe, expect, it } from 'vitest'; import { DEFAULT_AGENT_CONFIG } from '@/const/settings'; -import { CreateMessageParams, MessageModel } from '@/database/client/models/message'; -import { SessionGroupModel } from '@/database/client/models/sessionGroup'; -import { TopicModel } from '@/database/client/models/topic'; +import { CreateMessageParams, MessageModel } from '@/database/_deprecated/models/message'; +import { SessionGroupModel } from '@/database/_deprecated/models/sessionGroup'; +import { TopicModel } from '@/database/_deprecated/models/topic'; import { LobeAgentConfig } from '@/types/agent'; import { LobeAgentSession, diff --git a/src/database/client/models/__tests__/sessionGroup.test.ts b/src/database/_deprecated/models/__tests__/sessionGroup.test.ts similarity index 99% rename from src/database/client/models/__tests__/sessionGroup.test.ts rename to src/database/_deprecated/models/__tests__/sessionGroup.test.ts index 87d4e018ab6e..21b5066edfc4 100644 --- a/src/database/client/models/__tests__/sessionGroup.test.ts +++ b/src/database/_deprecated/models/__tests__/sessionGroup.test.ts @@ -1,6 +1,6 @@ import { afterEach, beforeEach, describe, expect, it } from 'vitest'; -import { SessionModel } from '@/database/client/models/session'; +import { SessionModel } from '@/database/_deprecated/models/session'; import { SessionGroups } from '@/types/session'; import { DB_SessionGroup } from '../../schemas/sessionGroup'; diff --git a/src/database/client/models/__tests__/topic.test.ts b/src/database/_deprecated/models/__tests__/topic.test.ts similarity index 98% rename from src/database/client/models/__tests__/topic.test.ts rename to src/database/_deprecated/models/__tests__/topic.test.ts index 079e746ce8e0..321bd74386ea 100644 --- a/src/database/client/models/__tests__/topic.test.ts +++ b/src/database/_deprecated/models/__tests__/topic.test.ts @@ -1,9 +1,9 @@ import { afterEach, beforeEach, describe, expect, it } from 'vitest'; -import { DBModel } from '@/database/client/core/types/db'; -import { CreateMessageParams, MessageModel } from '@/database/client/models/message'; -import { DB_Message } from '@/database/client/schemas/message'; -import { DB_Topic } from '@/database/client/schemas/topic'; +import { DBModel } from '@/database/_deprecated/core/types/db'; +import { CreateMessageParams, MessageModel } from '@/database/_deprecated/models/message'; +import { DB_Message } from '@/database/_deprecated/schemas/message'; +import { DB_Topic } from '@/database/_deprecated/schemas/topic'; import { nanoid } from '@/utils/uuid'; import * as uuidUtils from '@/utils/uuid'; diff --git a/src/database/client/models/__tests__/user.test.ts b/src/database/_deprecated/models/__tests__/user.test.ts similarity index 100% rename from src/database/client/models/__tests__/user.test.ts rename to src/database/_deprecated/models/__tests__/user.test.ts diff --git a/src/database/client/models/file.ts b/src/database/_deprecated/models/file.ts similarity index 84% rename from src/database/client/models/file.ts rename to src/database/_deprecated/models/file.ts index c41fcaf6eca5..f4a3244d8914 100644 --- a/src/database/client/models/file.ts +++ b/src/database/_deprecated/models/file.ts @@ -1,5 +1,5 @@ -import { DBModel } from '@/database/client/core/types/db'; -import { DB_File, DB_FileSchema } from '@/database/client/schemas/files'; +import { DBModel } from '@/database/_deprecated/core/types/db'; +import { DB_File, DB_FileSchema } from '@/database/_deprecated/schemas/files'; import { nanoid } from '@/utils/uuid'; import { BaseModel } from '../core'; diff --git a/src/database/client/models/message.ts b/src/database/_deprecated/models/message.ts similarity index 97% rename from src/database/client/models/message.ts rename to src/database/_deprecated/models/message.ts index 0474226a5d3c..2cfd6b11593e 100644 --- a/src/database/client/models/message.ts +++ b/src/database/_deprecated/models/message.ts @@ -1,8 +1,8 @@ import { DeepPartial } from 'utility-types'; -import { BaseModel } from '@/database/client/core'; -import { DBModel } from '@/database/client/core/types/db'; -import { DB_Message, DB_MessageSchema } from '@/database/client/schemas/message'; +import { BaseModel } from '@/database/_deprecated/core'; +import { DBModel } from '@/database/_deprecated/core/types/db'; +import { DB_Message, DB_MessageSchema } from '@/database/_deprecated/schemas/message'; import { ChatMessage } from '@/types/message'; import { nanoid } from '@/utils/uuid'; diff --git a/src/database/client/models/plugin.ts b/src/database/_deprecated/models/plugin.ts similarity index 96% rename from src/database/client/models/plugin.ts rename to src/database/_deprecated/models/plugin.ts index 3c074063e190..61c87222f7ab 100644 --- a/src/database/client/models/plugin.ts +++ b/src/database/_deprecated/models/plugin.ts @@ -1,6 +1,6 @@ import { LobeChatPluginManifest } from '@lobehub/chat-plugin-sdk'; -import { BaseModel } from '@/database/client/core'; +import { BaseModel } from '@/database/_deprecated/core'; import { LobeTool } from '@/types/tool'; import { merge } from '@/utils/merge'; diff --git a/src/database/client/models/session.ts b/src/database/_deprecated/models/session.ts similarity index 97% rename from src/database/client/models/session.ts rename to src/database/_deprecated/models/session.ts index a6ece1d87639..16961fb57ab1 100644 --- a/src/database/client/models/session.ts +++ b/src/database/_deprecated/models/session.ts @@ -1,9 +1,9 @@ import { DeepPartial } from 'utility-types'; import { DEFAULT_AGENT_LOBE_SESSION } from '@/const/session'; -import { BaseModel } from '@/database/client/core'; -import { DBModel } from '@/database/client/core/types/db'; -import { DB_Session, DB_SessionSchema } from '@/database/client/schemas/session'; +import { BaseModel } from '@/database/_deprecated/core'; +import { DBModel } from '@/database/_deprecated/core/types/db'; +import { DB_Session, DB_SessionSchema } from '@/database/_deprecated/schemas/session'; import { LobeAgentConfig } from '@/types/agent'; import { ChatSessionList, diff --git a/src/database/client/models/sessionGroup.ts b/src/database/_deprecated/models/sessionGroup.ts similarity index 96% rename from src/database/client/models/sessionGroup.ts rename to src/database/_deprecated/models/sessionGroup.ts index 583ddbb32352..fb934788a772 100644 --- a/src/database/client/models/sessionGroup.ts +++ b/src/database/_deprecated/models/sessionGroup.ts @@ -1,5 +1,5 @@ -import { BaseModel } from '@/database/client/core'; -import { DB_SessionGroup, DB_SessionGroupSchema } from '@/database/client/schemas/sessionGroup'; +import { BaseModel } from '@/database/_deprecated/core'; +import { DB_SessionGroup, DB_SessionGroupSchema } from '@/database/_deprecated/schemas/sessionGroup'; import { SessionGroups } from '@/types/session'; import { nanoid } from '@/utils/uuid'; diff --git a/src/database/client/models/topic.ts b/src/database/_deprecated/models/topic.ts similarity index 96% rename from src/database/client/models/topic.ts rename to src/database/_deprecated/models/topic.ts index e25e7e49b7c1..4c496a758422 100644 --- a/src/database/client/models/topic.ts +++ b/src/database/_deprecated/models/topic.ts @@ -1,7 +1,7 @@ -import { BaseModel } from '@/database/client/core'; -import { DBModel } from '@/database/client/core/types/db'; -import { MessageModel } from '@/database/client/models/message'; -import { DB_Topic, DB_TopicSchema } from '@/database/client/schemas/topic'; +import { BaseModel } from '@/database/_deprecated/core'; +import { DBModel } from '@/database/_deprecated/core/types/db'; +import { MessageModel } from '@/database/_deprecated/models/message'; +import { DB_Topic, DB_TopicSchema } from '@/database/_deprecated/schemas/topic'; import { ChatTopic } from '@/types/topic'; import { nanoid } from '@/utils/uuid'; diff --git a/src/database/client/models/user.ts b/src/database/_deprecated/models/user.ts similarity index 96% rename from src/database/client/models/user.ts rename to src/database/_deprecated/models/user.ts index 1162b197b7e5..e9dc5979ce0b 100644 --- a/src/database/client/models/user.ts +++ b/src/database/_deprecated/models/user.ts @@ -1,6 +1,6 @@ import { DeepPartial } from 'utility-types'; -import { BaseModel } from '@/database/client/core'; +import { BaseModel } from '@/database/_deprecated/core'; import { LobeAgentConfig } from '@/types/agent'; import { uuid } from '@/utils/uuid'; diff --git a/src/database/client/schemas/files.ts b/src/database/_deprecated/schemas/files.ts similarity index 100% rename from src/database/client/schemas/files.ts rename to src/database/_deprecated/schemas/files.ts diff --git a/src/database/client/schemas/message.ts b/src/database/_deprecated/schemas/message.ts similarity index 100% rename from src/database/client/schemas/message.ts rename to src/database/_deprecated/schemas/message.ts diff --git a/src/database/client/schemas/plugin.ts b/src/database/_deprecated/schemas/plugin.ts similarity index 100% rename from src/database/client/schemas/plugin.ts rename to src/database/_deprecated/schemas/plugin.ts diff --git a/src/database/client/schemas/session.ts b/src/database/_deprecated/schemas/session.ts similarity index 100% rename from src/database/client/schemas/session.ts rename to src/database/_deprecated/schemas/session.ts diff --git a/src/database/client/schemas/sessionGroup.ts b/src/database/_deprecated/schemas/sessionGroup.ts similarity index 100% rename from src/database/client/schemas/sessionGroup.ts rename to src/database/_deprecated/schemas/sessionGroup.ts diff --git a/src/database/client/schemas/topic.ts b/src/database/_deprecated/schemas/topic.ts similarity index 100% rename from src/database/client/schemas/topic.ts rename to src/database/_deprecated/schemas/topic.ts diff --git a/src/database/client/schemas/user.ts b/src/database/_deprecated/schemas/user.ts similarity index 92% rename from src/database/client/schemas/user.ts rename to src/database/_deprecated/schemas/user.ts index 3aad822a6ce9..e78458879d9c 100644 --- a/src/database/client/schemas/user.ts +++ b/src/database/_deprecated/schemas/user.ts @@ -1,6 +1,6 @@ import { z } from 'zod'; -import { AgentSchema } from '@/database/client/schemas/session'; +import { AgentSchema } from '@/database/_deprecated/schemas/session'; import { LobeMetaDataSchema } from '@/types/meta'; const generalSechma = z.object({ diff --git a/src/services/__tests__/sync.test.ts b/src/services/__tests__/sync.test.ts index 7010131065e9..7ebe9a5bd13f 100644 --- a/src/services/__tests__/sync.test.ts +++ b/src/services/__tests__/sync.test.ts @@ -1,11 +1,11 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { dataSync } from '@/database/client/core'; +import { dataSync } from '@/database/_deprecated/core'; import { StartDataSyncParams } from '@/types/sync'; import { syncService } from '../sync'; -vi.mock('@/database/client/core', () => ({ +vi.mock('@/database/_deprecated/core', () => ({ dataSync: { startDataSync: vi.fn(), disconnect: vi.fn(), diff --git a/src/services/debug.ts b/src/services/debug.ts index ea91a275efe1..1584e5f8de3e 100644 --- a/src/services/debug.ts +++ b/src/services/debug.ts @@ -1,4 +1,4 @@ -import { DEBUG_MODEL } from '@/database/client/models/__DEBUG'; +import { DEBUG_MODEL } from '@/database/_deprecated/models/__DEBUG'; class DebugService { async insertLargeDataToDB() { diff --git a/src/services/file/client.test.ts b/src/services/file/client.test.ts index b7282fb4de4a..636db762c4cf 100644 --- a/src/services/file/client.test.ts +++ b/src/services/file/client.test.ts @@ -1,8 +1,8 @@ import { Mock, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; import { fileEnv } from '@/config/file'; -import { FileModel } from '@/database/client/models/file'; -import { DB_File } from '@/database/client/schemas/files'; +import { FileModel } from '@/database/_deprecated/models/file'; +import { DB_File } from '@/database/_deprecated/schemas/files'; import { serverConfigSelectors } from '@/store/serverConfig/selectors'; import { createServerConfigStore } from '@/store/serverConfig/store'; @@ -14,7 +14,7 @@ beforeAll(() => { createServerConfigStore(); }); // Mocks for the FileModel -vi.mock('@/database/client/models/file', () => ({ +vi.mock('@/database/_deprecated/models/file', () => ({ FileModel: { create: vi.fn(), delete: vi.fn(), diff --git a/src/services/file/client.ts b/src/services/file/client.ts index f9361238a2fa..babfa78322c3 100644 --- a/src/services/file/client.ts +++ b/src/services/file/client.ts @@ -1,5 +1,5 @@ -import { FileModel } from '@/database/client/models/file'; -import { DB_File } from '@/database/client/schemas/files'; +import { FileModel } from '@/database/_deprecated/models/file'; +import { DB_File } from '@/database/_deprecated/schemas/files'; import { FileItem } from '@/types/files'; import { IFileService } from './type'; diff --git a/src/services/import/client.ts b/src/services/import/client.ts index 274e3b81028f..d246c5b29425 100644 --- a/src/services/import/client.ts +++ b/src/services/import/client.ts @@ -1,7 +1,7 @@ -import { MessageModel } from '@/database/client/models/message'; -import { SessionModel } from '@/database/client/models/session'; -import { SessionGroupModel } from '@/database/client/models/sessionGroup'; -import { TopicModel } from '@/database/client/models/topic'; +import { MessageModel } from '@/database/_deprecated/models/message'; +import { SessionModel } from '@/database/_deprecated/models/session'; +import { SessionGroupModel } from '@/database/_deprecated/models/sessionGroup'; +import { TopicModel } from '@/database/_deprecated/models/topic'; import { ImportResult, ImportResults } from '@/services/config'; import { useUserStore } from '@/store/user'; import { ImportStage, ImporterEntryData, OnImportCallbacks } from '@/types/importer'; diff --git a/src/services/message/client.test.ts b/src/services/message/client.test.ts index 3e777fb00d88..867fda6c5b72 100644 --- a/src/services/message/client.test.ts +++ b/src/services/message/client.test.ts @@ -1,7 +1,7 @@ import dayjs from 'dayjs'; import { Mock, describe, expect, it, vi } from 'vitest'; -import { CreateMessageParams, MessageModel } from '@/database/client/models/message'; +import { CreateMessageParams, MessageModel } from '@/database/_deprecated/models/message'; import { ChatMessage, ChatMessageError, @@ -15,7 +15,7 @@ import { ClientService } from './client'; const messageService = new ClientService(); // Mock the MessageModel -vi.mock('@/database/client/models/message', () => { +vi.mock('@/database/_deprecated/models/message', () => { return { MessageModel: { create: vi.fn(), diff --git a/src/services/message/client.ts b/src/services/message/client.ts index 3ee501251feb..d51d6d72a1a4 100644 --- a/src/services/message/client.ts +++ b/src/services/message/client.ts @@ -1,8 +1,8 @@ import dayjs from 'dayjs'; -import { FileModel } from '@/database/client/models/file'; -import { MessageModel } from '@/database/client/models/message'; -import { DB_Message } from '@/database/client/schemas/message'; +import { FileModel } from '@/database/_deprecated/models/file'; +import { MessageModel } from '@/database/_deprecated/models/message'; +import { DB_Message } from '@/database/_deprecated/schemas/message'; import { ChatFileItem, ChatMessage, diff --git a/src/services/message/index.test.ts b/src/services/message/index.test.ts index 25e89235e35d..625261f53c90 100644 --- a/src/services/message/index.test.ts +++ b/src/services/message/index.test.ts @@ -1,12 +1,12 @@ import { Mock, describe, expect, it, vi } from 'vitest'; -import { CreateMessageParams, MessageModel } from '@/database/client/models/message'; +import { CreateMessageParams, MessageModel } from '@/database/_deprecated/models/message'; import { ChatMessage, ChatMessageError, ChatPluginPayload } from '@/types/message'; import { messageService } from './index'; // Mock the MessageModel -vi.mock('@/database/client/models/message', () => { +vi.mock('@/database/_deprecated/models/message', () => { return { MessageModel: { count: vi.fn(), diff --git a/src/services/message/type.ts b/src/services/message/type.ts index d151a80aff49..2929620ad128 100644 --- a/src/services/message/type.ts +++ b/src/services/message/type.ts @@ -1,4 +1,4 @@ -import { DB_Message } from '@/database/client/schemas/message'; +import { DB_Message } from '@/database/_deprecated/schemas/message'; import { ChatMessage, ChatMessageError, diff --git a/src/services/plugin/client.test.ts b/src/services/plugin/client.test.ts index e90c7cdf5247..e2b6ccc66822 100644 --- a/src/services/plugin/client.test.ts +++ b/src/services/plugin/client.test.ts @@ -1,8 +1,8 @@ import { LobeChatPluginManifest } from '@lobehub/chat-plugin-sdk'; import { beforeEach, describe, expect, it, vi } from 'vitest'; -import { PluginModel } from '@/database/client/models/plugin'; -import { DB_Plugin } from '@/database/client/schemas/plugin'; +import { PluginModel } from '@/database/_deprecated/models/plugin'; +import { DB_Plugin } from '@/database/_deprecated/schemas/plugin'; import { LobeTool } from '@/types/tool'; import { LobeToolCustomPlugin } from '@/types/tool/plugin'; @@ -13,7 +13,7 @@ const pluginService = new ClientService(); // Mocking modules and functions -vi.mock('@/database/client/models/plugin', () => ({ +vi.mock('@/database/_deprecated/models/plugin', () => ({ PluginModel: { getList: vi.fn(), create: vi.fn(), diff --git a/src/services/plugin/client.ts b/src/services/plugin/client.ts index cb2f1682e54c..c56f73119c14 100644 --- a/src/services/plugin/client.ts +++ b/src/services/plugin/client.ts @@ -1,6 +1,6 @@ import { LobeChatPluginManifest } from '@lobehub/chat-plugin-sdk'; -import { PluginModel } from '@/database/client/models/plugin'; +import { PluginModel } from '@/database/_deprecated/models/plugin'; import { LobeTool } from '@/types/tool'; import { LobeToolCustomPlugin } from '@/types/tool/plugin'; diff --git a/src/services/session/client.test.ts b/src/services/session/client.test.ts index aa5299782b79..4a7274ce547a 100644 --- a/src/services/session/client.test.ts +++ b/src/services/session/client.test.ts @@ -1,7 +1,7 @@ import { Mock, beforeEach, describe, expect, it, vi } from 'vitest'; -import { SessionModel } from '@/database/client/models/session'; -import { SessionGroupModel } from '@/database/client/models/sessionGroup'; +import { SessionModel } from '@/database/_deprecated/models/session'; +import { SessionGroupModel } from '@/database/_deprecated/models/sessionGroup'; import { LobeAgentConfig } from '@/types/agent'; import { LobeAgentSession, LobeSessionType, SessionGroups } from '@/types/session'; @@ -10,7 +10,7 @@ import { ClientService } from './client'; const sessionService = new ClientService(); // Mock the SessionModel -vi.mock('@/database/client/models/session', () => { +vi.mock('@/database/_deprecated/models/session', () => { return { SessionModel: { create: vi.fn(), @@ -33,7 +33,7 @@ vi.mock('@/database/client/models/session', () => { }); // Mock the SessionGroupModel -vi.mock('@/database/client/models/sessionGroup', () => { +vi.mock('@/database/_deprecated/models/sessionGroup', () => { return { SessionGroupModel: { create: vi.fn(), diff --git a/src/services/session/client.ts b/src/services/session/client.ts index 0f17fcefe778..2d205cca8c8c 100644 --- a/src/services/session/client.ts +++ b/src/services/session/client.ts @@ -1,9 +1,9 @@ import { DeepPartial } from 'utility-types'; import { INBOX_SESSION_ID } from '@/const/session'; -import { SessionModel } from '@/database/client/models/session'; -import { SessionGroupModel } from '@/database/client/models/sessionGroup'; -import { UserModel } from '@/database/client/models/user'; +import { SessionModel } from '@/database/_deprecated/models/session'; +import { SessionGroupModel } from '@/database/_deprecated/models/sessionGroup'; +import { UserModel } from '@/database/_deprecated/models/user'; import { useUserStore } from '@/store/user'; import { LobeAgentChatConfig, LobeAgentConfig } from '@/types/agent'; import { MetaData } from '@/types/meta'; diff --git a/src/services/sync.ts b/src/services/sync.ts index 6331ccec209a..03e8b8bbc9a8 100644 --- a/src/services/sync.ts +++ b/src/services/sync.ts @@ -1,4 +1,4 @@ -import { dataSync } from '@/database/client/core'; +import { dataSync } from '@/database/_deprecated/core'; import { StartDataSyncParams } from '@/types/sync'; class SyncService { diff --git a/src/services/topic/client.test.ts b/src/services/topic/client.test.ts index 9c2eadfb7bd0..211abefa7d36 100644 --- a/src/services/topic/client.test.ts +++ b/src/services/topic/client.test.ts @@ -1,14 +1,14 @@ import { Mock, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; -import { SessionModel } from '@/database/client/models/session'; -import { CreateTopicParams, TopicModel } from '@/database/client/models/topic'; +import { SessionModel } from '@/database/_deprecated/models/session'; +import { CreateTopicParams, TopicModel } from '@/database/_deprecated/models/topic'; import { ChatTopic } from '@/types/topic'; import { ClientService } from './client'; const topicService = new ClientService(); // Mock the TopicModel -vi.mock('@/database/client/models/topic', () => { +vi.mock('@/database/_deprecated/models/topic', () => { return { TopicModel: { create: vi.fn(), diff --git a/src/services/topic/client.ts b/src/services/topic/client.ts index 1be53520ed17..eeb2ffa2e395 100644 --- a/src/services/topic/client.ts +++ b/src/services/topic/client.ts @@ -1,4 +1,4 @@ -import { TopicModel } from '@/database/client/models/topic'; +import { TopicModel } from '@/database/_deprecated/models/topic'; import { ChatTopic } from '@/types/topic'; import { CreateTopicParams, ITopicService, QueryTopicParams } from './type'; diff --git a/src/services/upload.ts b/src/services/upload.ts index 311b329150e3..38f6cdd2959b 100644 --- a/src/services/upload.ts +++ b/src/services/upload.ts @@ -67,7 +67,7 @@ class UploadService { }; uploadToClientDB = async (params: UploadFileParams, file: File) => { - const { FileModel } = await import('@/database/client/models/file'); + const { FileModel } = await import('@/database/_deprecated/models/file'); const fileArrayBuffer = await file.arrayBuffer(); // save to local storage diff --git a/src/services/user/client.test.ts b/src/services/user/client.test.ts index d289252493ef..f79f8294a2f5 100644 --- a/src/services/user/client.test.ts +++ b/src/services/user/client.test.ts @@ -1,14 +1,14 @@ import { DeepPartial } from 'utility-types'; import { Mock, beforeEach, describe, expect, it, vi } from 'vitest'; -import { UserModel } from '@/database/client/models/user'; +import { UserModel } from '@/database/_deprecated/models/user'; import { UserPreference } from '@/types/user'; import { UserSettings } from '@/types/user/settings'; import { AsyncLocalStorage } from '@/utils/localStorage'; import { ClientService } from './client'; -vi.mock('@/database/client/models/user', () => ({ +vi.mock('@/database/_deprecated/models/user', () => ({ UserModel: { getUser: vi.fn(), updateSettings: vi.fn(), diff --git a/src/services/user/client.ts b/src/services/user/client.ts index 4554b16fa4be..500d856a11b5 100644 --- a/src/services/user/client.ts +++ b/src/services/user/client.ts @@ -1,8 +1,8 @@ import { DeepPartial } from 'utility-types'; -import { MessageModel } from '@/database/client/models/message'; -import { SessionModel } from '@/database/client/models/session'; -import { UserModel } from '@/database/client/models/user'; +import { MessageModel } from '@/database/_deprecated/models/message'; +import { SessionModel } from '@/database/_deprecated/models/session'; +import { UserModel } from '@/database/_deprecated/models/user'; import { UserGuide, UserInitializationState, UserPreference } from '@/types/user'; import { UserSettings } from '@/types/user/settings'; import { AsyncLocalStorage } from '@/utils/localStorage'; diff --git a/src/store/file/slices/chat/action.test.ts b/src/store/file/slices/chat/action.test.ts index 0050168d81ee..88eacd4cc46b 100644 --- a/src/store/file/slices/chat/action.test.ts +++ b/src/store/file/slices/chat/action.test.ts @@ -3,7 +3,7 @@ import useSWR from 'swr'; import { Mock, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; import { notification } from '@/components/AntdStaticMethods'; -import { DB_File } from '@/database/client/schemas/files'; +import { DB_File } from '@/database/_deprecated/schemas/files'; import { fileService } from '@/services/file'; import { uploadService } from '@/services/upload'; diff --git a/src/types/sync.ts b/src/types/sync.ts index 23d869f37f4b..dc83beccb689 100644 --- a/src/types/sync.ts +++ b/src/types/sync.ts @@ -1,4 +1,4 @@ -import { LobeDBSchemaMap } from '@/database/client/core/db'; +import { LobeDBSchemaMap } from '@/database/_deprecated/core/db'; export type OnSyncEvent = (tableKey: keyof LobeDBSchemaMap) => void; export type OnSyncStatusChange = (status: PeerSyncStatus) => void; From ee2e2defb8f1275a963f09ad959a8b670b2eaa48 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 2 Dec 2024 11:47:14 +0000 Subject: [PATCH 6/7] :bookmark: chore(release): v1.35.5 [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### [Version 1.35.5](https://github.com/lobehub/lobe-chat/compare/v1.35.4...v1.35.5) Released on **2024-12-02** #### ♻ Code Refactoring - **misc**: Deprecated the current client mode code.
Improvements and Fixes #### Code refactoring * **misc**: Deprecated the current client mode code, closes [#4866](https://github.com/lobehub/lobe-chat/issues/4866) ([7dff458](https://github.com/lobehub/lobe-chat/commit/7dff458))
[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
--- CHANGELOG.md | 25 +++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc9523f400dc..fe3cedd651fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,31 @@ # Changelog +### [Version 1.35.5](https://github.com/lobehub/lobe-chat/compare/v1.35.4...v1.35.5) + +Released on **2024-12-02** + +#### ♻ Code Refactoring + +- **misc**: Deprecated the current client mode code. + +
+ +
+Improvements and Fixes + +#### Code refactoring + +- **misc**: Deprecated the current client mode code, closes [#4866](https://github.com/lobehub/lobe-chat/issues/4866) ([7dff458](https://github.com/lobehub/lobe-chat/commit/7dff458)) + +
+ +
+ +[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top) + +
+ ### [Version 1.35.4](https://github.com/lobehub/lobe-chat/compare/v1.35.3...v1.35.4) Released on **2024-12-02** diff --git a/package.json b/package.json index 870240e1d907..3e151b5360e2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lobehub/chat", - "version": "1.35.4", + "version": "1.35.5", "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.", "keywords": [ "framework", From 77c7aa36d3a9a09ffebfb6efb756dcddf24d2455 Mon Sep 17 00:00:00 2001 From: lobehubbot Date: Mon, 2 Dec 2024 11:48:11 +0000 Subject: [PATCH 7/7] =?UTF-8?q?=F0=9F=93=9D=20docs(bot):=20Auto=20sync=20a?= =?UTF-8?q?gents=20&=20plugin=20to=20readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog/v1.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/changelog/v1.json b/changelog/v1.json index 1034f7f3ed15..7a6c7aed4eeb 100644 --- a/changelog/v1.json +++ b/changelog/v1.json @@ -1,4 +1,11 @@ [ + { + "children": { + "improvements": ["Deprecated the current client mode code."] + }, + "date": "2024-12-02", + "version": "1.35.5" + }, { "children": {}, "date": "2024-12-02",