Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/lobehub/lobe-chat
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Dec 31, 2024
2 parents f7d5871 + 6e8c961 commit df092c1
Show file tree
Hide file tree
Showing 36 changed files with 718 additions and 100 deletions.
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,39 @@

# Changelog

### [Version 1.42.2](https://github.com/lobehub/lobe-chat/compare/v1.42.1...v1.42.2)

<sup>Released on **2024-12-31**</sup>

#### ♻ Code Refactoring

- **misc**: Refactor the agent runtime payload.

#### 💄 Styles

- **misc**: Add o1 model in openai and openrouter models.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### Code refactoring

- **misc**: Refactor the agent runtime payload, closes [#5250](https://github.com/lobehub/lobe-chat/issues/5250) ([e420ab3](https://github.com/lobehub/lobe-chat/commit/e420ab3))

#### Styles

- **misc**: Add o1 model in openai and openrouter models, closes [#5236](https://github.com/lobehub/lobe-chat/issues/5236) ([f733852](https://github.com/lobehub/lobe-chat/commit/f733852))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>

### [Version 1.42.1](https://github.com/lobehub/lobe-chat/compare/v1.42.0...v1.42.1)

<sup>Released on **2024-12-29**</sup>
Expand Down
12 changes: 6 additions & 6 deletions README.ja-JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,12 @@ LobeChat のプラグインエコシステムは、そのコア機能の重要
<!-- PLUGIN LIST -->

| 最近追加 | 説明 |
| ------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| [PortfolioMeta](https://lobechat.com/discover/plugin/StockData)<br/><sup>By **portfoliometa** on **2024-12-22**</sup> | 株を分析し、包括的なリアルタイムの投資データと分析を取得します。<br/>`stock` |
| [Google CSE](https://lobechat.com/discover/plugin/google-cse)<br/><sup>By **vsnthdev** on **2024-12-02**</sup> | 公式の CSE API を通じて Google を検索します。<br/>`ウェブ` `検索` |
| [話す](https://lobechat.com/discover/plugin/speak)<br/><sup>By **speak** on **2024-12-02**</sup> | Speak は、AI パワードの言語チューターで、他の言語で何でも言う方法を学ぶことができます。<br/>`教育` `言語` |
| [Tongyi Wanxiang 画像生成器](https://lobechat.com/discover/plugin/alps-tongyi-image)<br/><sup>By **YoungTx** on **2024-08-09**</sup> | このプラグインは、Alibaba の Tongyi Wanxiang モデルを使用して、テキストプロンプトに基づいて画像を生成します。<br/>`画像` `トンギ` `ワンシャン` |
| 最近追加 | 説明 |
| ---------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| [MintbaseSearch](https://lobechat.com/discover/plugin/mintbasesearch)<br/><sup>By **mintbase** on **2024-12-31**</sup> | NEAR プロトコル上の任意の NFT データを見つける。<br/>`暗号通貨` `nft` |
| [PortfolioMeta](https://lobechat.com/discover/plugin/StockData)<br/><sup>By **portfoliometa** on **2024-12-22**</sup> | 株を分析し、包括的なリアルタイムの投資データと分析を取得します。<br/>`stock` |
| [Google CSE](https://lobechat.com/discover/plugin/google-cse)<br/><sup>By **vsnthdev** on **2024-12-02**</sup> | 公式の CSE API を通じて Google を検索します。<br/>`ウェブ` `検索` |
| [話す](https://lobechat.com/discover/plugin/speak)<br/><sup>By **speak** on **2024-12-02**</sup> | Speak は、AI パワードの言語チューターで、他の言語で何でも言う方法を学ぶことができます。<br/>`教育` `言語` |

> 📊 Total plugins: [<kbd>**48**</kbd>](https://lobechat.com/discover/plugins)
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,12 @@ In addition, these plugins are not limited to news aggregation, but can also ext
<!-- PLUGIN LIST -->

| Recent Submits | Description |
| ----------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| [PortfolioMeta](https://lobechat.com/discover/plugin/StockData)<br/><sup>By **portfoliometa** on **2024-12-22**</sup> | Analyze stocks and get comprehensive real-time investment data and analytics.<br/>`stock` |
| [Google CSE](https://lobechat.com/discover/plugin/google-cse)<br/><sup>By **vsnthdev** on **2024-12-02**</sup> | Searches Google through their official CSE API.<br/>`web` `search` |
| [Speak](https://lobechat.com/discover/plugin/speak)<br/><sup>By **speak** on **2024-12-02**</sup> | Learn how to say anything in another language with Speak, your AI-powered language tutor.<br/>`education` `language` |
| [Tongyi wanxiang Image Generator](https://lobechat.com/discover/plugin/alps-tongyi-image)<br/><sup>By **YoungTx** on **2024-08-09**</sup> | This plugin uses Alibaba's Tongyi Wanxiang model to generate images based on text prompts.<br/>`image` `tongyi` `wanxiang` |
| Recent Submits | Description |
| ---------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| [MintbaseSearch](https://lobechat.com/discover/plugin/mintbasesearch)<br/><sup>By **mintbase** on **2024-12-31**</sup> | Find any NFT data on the NEAR Protocol.<br/>`crypto` `nft` |
| [PortfolioMeta](https://lobechat.com/discover/plugin/StockData)<br/><sup>By **portfoliometa** on **2024-12-22**</sup> | Analyze stocks and get comprehensive real-time investment data and analytics.<br/>`stock` |
| [Google CSE](https://lobechat.com/discover/plugin/google-cse)<br/><sup>By **vsnthdev** on **2024-12-02**</sup> | Searches Google through their official CSE API.<br/>`web` `search` |
| [Speak](https://lobechat.com/discover/plugin/speak)<br/><sup>By **speak** on **2024-12-02**</sup> | Learn how to say anything in another language with Speak, your AI-powered language tutor.<br/>`education` `language` |

> 📊 Total plugins: [<kbd>**48**</kbd>](https://lobechat.com/discover/plugins)
Expand Down
12 changes: 6 additions & 6 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ LobeChat 的插件生态系统是其核心功能的重要扩展,它极大地
<!-- PLUGIN LIST -->

| 最近新增 | 描述 |
| ---------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| [PortfolioMeta](https://lobechat.com/discover/plugin/StockData)<br/><sup>By **portfoliometa** on **2024-12-22**</sup> | 分析股票并获取全面的实时投资数据和分析。<br/>`股票` |
| [谷歌自定义搜索引擎](https://lobechat.com/discover/plugin/google-cse)<br/><sup>By **vsnthdev** on **2024-12-02**</sup> | 通过他们的官方自定义搜索引擎 API 搜索谷歌。<br/>`网络` `搜索` |
| [Speak](https://lobechat.com/discover/plugin/speak)<br/><sup>By **speak** on **2024-12-02**</sup> | 使用 Speak,您的 AI 语言导师,学习如何用另一种语言说任何事情。<br/>`教育` `语言` |
| [通义万象图像生成器](https://lobechat.com/discover/plugin/alps-tongyi-image)<br/><sup>By **YoungTx** on **2024-08-09**</sup> | 此插件使用阿里巴巴的通义万象模型根据文本提示生成图像。<br/>`图像` `通义` `万象` |
| 最近新增 | 描述 |
| ---------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| [MintbaseSearch](https://lobechat.com/discover/plugin/mintbasesearch)<br/><sup>By **mintbase** on **2024-12-31**</sup> | 在 NEAR 协议上查找任何 NFT 数据。<br/>`加密货币` `nft` |
| [PortfolioMeta](https://lobechat.com/discover/plugin/StockData)<br/><sup>By **portfoliometa** on **2024-12-22**</sup> | 分析股票并获取全面的实时投资数据和分析。<br/>`股票` |
| [谷歌自定义搜索引擎](https://lobechat.com/discover/plugin/google-cse)<br/><sup>By **vsnthdev** on **2024-12-02**</sup> | 通过他们的官方自定义搜索引擎 API 搜索谷歌。<br/>`网络` `搜索` |
| [Speak](https://lobechat.com/discover/plugin/speak)<br/><sup>By **speak** on **2024-12-02**</sup> | 使用 Speak,您的 AI 语言导师,学习如何用另一种语言说任何事情。<br/>`教育` `语言` |

> 📊 Total plugins: [<kbd>**48**</kbd>](https://lobechat.com/discover/plugins)
Expand Down
7 changes: 7 additions & 0 deletions changelog/v1.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
[
{
"children": {
"improvements": ["Add o1 model in openai and openrouter models."]
},
"date": "2024-12-31",
"version": "1.42.2"
},
{
"children": {
"fixes": ["Fix custom max_token not saved from customModelCards."]
Expand Down
1 change: 0 additions & 1 deletion next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const nextConfig: NextConfig = {
'@icons-pack/react-simple-icons',
'@lobehub/ui',
'gpt-tokenizer',
'chroma-js',
],
webVitalsAttribution: ['CLS', 'LCP'],
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lobehub/chat",
"version": "1.42.1",
"version": "1.42.2",
"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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import { Checkbox, Form, FormInstance, Input } from 'antd';
import { memo, useEffect } from 'react';
import { useTranslation } from 'react-i18next';

import MaxTokenSlider from '@/components/MaxTokenSlider';
import { useIsMobile } from '@/hooks/useIsMobile';
import { ChatModelCard } from '@/types/llm';

import MaxTokenSlider from './MaxTokenSlider';

interface ModelConfigFormProps {
initialValues?: ChatModelCard;
onFormInstanceReady: (instance: FormInstance) => void;
Expand Down Expand Up @@ -66,7 +65,10 @@ const ModelConfigForm = memo<ModelConfigFormProps>(
>
<Input placeholder={t('llm.customModelCards.modelConfig.displayName.placeholder')} />
</Form.Item>
<Form.Item label={t('llm.customModelCards.modelConfig.tokens.title')} name={'contextWindowTokens'}>
<Form.Item
label={t('llm.customModelCards.modelConfig.tokens.title')}
name={'contextWindowTokens'}
>
<MaxTokenSlider />
</Form.Item>
<Form.Item
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { useTranslation } from 'react-i18next';
import { Flexbox } from 'react-layout-kit';
import useMergeState from 'use-merge-value';

import { useServerConfigStore } from '@/store/serverConfig';
import { serverConfigSelectors } from '@/store/serverConfig/selectors';
import { useIsMobile } from '@/hooks/useIsMobile';

const Kibi = 1024;

Expand All @@ -20,7 +19,7 @@ interface MaxTokenSliderProps {
}

const MaxTokenSlider = memo<MaxTokenSliderProps>(({ value, onChange, defaultValue }) => {
const { t } = useTranslation('setting');
const { t } = useTranslation('components');

const [token, setTokens] = useMergeState(0, {
defaultValue,
Expand All @@ -45,7 +44,7 @@ const MaxTokenSlider = memo<MaxTokenSliderProps>(({ value, onChange, defaultValu
setPowValue(exponent(value / Kibi));
};

const isMobile = useServerConfigStore(serverConfigSelectors.isMobile);
const isMobile = useIsMobile();

const marks = useMemo(() => {
return {
Expand Down Expand Up @@ -74,7 +73,7 @@ const MaxTokenSlider = memo<MaxTokenSliderProps>(({ value, onChange, defaultValu
tooltip={{
formatter: (x) => {
if (typeof x === 'undefined') return;
if (x === 0) return t('llm.customModelCards.modelConfig.tokens.unlimited');
if (x === 0) return t('MaxTokenSlider.unlimited');

let value = getRealValue(x);
if (value < 125) return value.toFixed(0) + 'K';
Expand Down
9 changes: 6 additions & 3 deletions src/components/ModelSelect/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { FC, memo } from 'react';
import { useTranslation } from 'react-i18next';
import { Center, Flexbox } from 'react-layout-kit';

import { ModelAbilities } from '@/types/aiModel';
import { ChatModelCard } from '@/types/llm';
import { formatTokenNumber } from '@/utils/format';

Expand Down Expand Up @@ -57,8 +58,10 @@ const useStyles = createStyles(({ css, token }) => ({
`,
}));

interface ModelInfoTagsProps extends ChatModelCard {
interface ModelInfoTagsProps extends ModelAbilities {
contextWindowTokens?: number | null;
directionReverse?: boolean;
isCustom?: boolean;
placement?: 'top' | 'right';
}

Expand Down Expand Up @@ -102,7 +105,7 @@ export const ModelInfoTags = memo<ModelInfoTagsProps>(
</div>
</Tooltip>
)}
{model.contextWindowTokens !== undefined && (
{typeof model.contextWindowTokens === 'number' && (
<Tooltip
overlayStyle={{ maxWidth: 'unset', pointerEvents: 'none' }}
placement={placement}
Expand All @@ -117,7 +120,7 @@ export const ModelInfoTags = memo<ModelInfoTagsProps>(
{model.contextWindowTokens === 0 ? (
<Infinity size={17} strokeWidth={1.6} />
) : (
formatTokenNumber(model.contextWindowTokens)
formatTokenNumber(model.contextWindowTokens as number)
)}
</Center>
</Tooltip>
Expand Down
10 changes: 9 additions & 1 deletion src/components/NProgress/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@ import { memo } from 'react';

const NProgress = memo(() => {
const theme = useTheme();
return <NextTopLoader color={theme.colorText} height={2} shadow={false} showSpinner={false} />;
return (
<NextTopLoader
color={theme.colorText}
height={2}
shadow={false}
showSpinner={false}
zIndex={1000}
/>
);
});

export default NProgress;
15 changes: 15 additions & 0 deletions src/config/modelProviders/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@ const OpenAI: ModelProviderCard = {
},
releasedAt: '2024-09-12',
},
{
contextWindowTokens: 200_000,
description:
'o1是OpenAI新的推理模型,支持图文输入并输出文本,适用于需要广泛通用知识的复杂任务。该模型具有200K上下文和2023年10月的知识截止日期。',
displayName: 'OpenAI o1',
enabled: true,
id: 'o1-2024-12-17',
maxOutput: 100_000,
pricing: {
input: 15,
output: 60,
},
releasedAt: '2024-12-17',
vision: true,
},
{
contextWindowTokens: 128_000,
description:
Expand Down
15 changes: 15 additions & 0 deletions src/config/modelProviders/openrouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ const OpenRouter: ModelProviderCard = {
},
releasedAt: '2024-09-12',
},
{
contextWindowTokens: 200_000,
description:
'o1是OpenAI新的推理模型,支持图文输入并输出文本,适用于需要广泛通用知识的复杂任务。该模型具有200K上下文和2023年10月的知识截止日期。',
displayName: 'OpenAI o1',
enabled: true,
id: 'openai/o1',
maxOutput: 100_000,
pricing: {
input: 15,
output: 60,
},
releasedAt: '2024-12-17',
vision: true,
},
{
contextWindowTokens: 128_000,
description:
Expand Down
2 changes: 1 addition & 1 deletion src/const/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface JWTPayload {
/**
* Represents the endpoint of provider
*/
endpoint?: string;
baseURL?: string;

azureApiVersion?: string;

Expand Down
11 changes: 11 additions & 0 deletions src/database/server/models/__tests__/user.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,17 @@ describe('UserModel', () => {
});
});

describe('getUserSettings', () => {
it('should get user settings', async () => {
await serverDB.insert(users).values({ id: userId });
await serverDB.insert(userSettings).values({ id: userId, general: { language: 'en-US' } });

const data = await userModel.getUserSettings();

expect(data).toMatchObject({ id: userId, general: { language: 'en-US' } });
});
});

describe('deleteSetting', () => {
it('should delete user settings', async () => {
await serverDB.insert(users).values({ id: userId });
Expand Down
4 changes: 4 additions & 0 deletions src/database/server/models/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ export class UserModel {
};
};

getUserSettings = async () => {
return this.db.query.userSettings.findFirst({ where: eq(userSettings.id, this.userId) });
};

updateUser = async (value: Partial<UserItem>) => {
return this.db
.update(users)
Expand Down
Loading

0 comments on commit df092c1

Please sign in to comment.