Skip to content

Commit

Permalink
Merge branch 'lobehub:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
sxjeru authored Apr 15, 2024
2 parents 7adaaa0 + dbfa63f commit f4a30ec
Show file tree
Hide file tree
Showing 105 changed files with 744 additions and 413 deletions.
150 changes: 150 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,156 @@

# Changelog

### [Version 0.147.16](https://github.com/lobehub/lobe-chat/compare/v0.147.15...v0.147.16)

<sup>Released on **2024-04-14**</sup>

#### ♻ Code Refactoring

- **misc**: Refactor the auth.

<br/>

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

#### Code refactoring

- **misc**: Refactor the auth, closes [#2043](https://github.com/lobehub/lobe-chat/issues/2043) ([37ecb41](https://github.com/lobehub/lobe-chat/commit/37ecb41))

</details>

<div align="right">

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

</div>

### [Version 0.147.15](https://github.com/lobehub/lobe-chat/compare/v0.147.14...v0.147.15)

<sup>Released on **2024-04-14**</sup>

#### 🐛 Bug Fixes

- **misc**: Fix tool call error with gpt-4-turbo.

<br/>

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

#### What's fixed

- **misc**: Fix tool call error with gpt-4-turbo, closes [#2042](https://github.com/lobehub/lobe-chat/issues/2042) ([63d91b8](https://github.com/lobehub/lobe-chat/commit/63d91b8))

</details>

<div align="right">

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

</div>

### [Version 0.147.14](https://github.com/lobehub/lobe-chat/compare/v0.147.13...v0.147.14)

<sup>Released on **2024-04-14**</sup>

#### 💄 Styles

- **misc**: Enable `gemini-1.5-pro-latest` model by default.

<br/>

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

#### Styles

- **misc**: Enable `gemini-1.5-pro-latest` model by default, closes [#2034](https://github.com/lobehub/lobe-chat/issues/2034) ([e8c65a9](https://github.com/lobehub/lobe-chat/commit/e8c65a9))

</details>

<div align="right">

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

</div>

### [Version 0.147.13](https://github.com/lobehub/lobe-chat/compare/v0.147.12...v0.147.13)

<sup>Released on **2024-04-14**</sup>

#### ♻ Code Refactoring

- **misc**: Refactor the service with browser db invoke.

<br/>

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

#### Code refactoring

- **misc**: Refactor the service with browser db invoke, closes [#2038](https://github.com/lobehub/lobe-chat/issues/2038) ([43a2791](https://github.com/lobehub/lobe-chat/commit/43a2791))

</details>

<div align="right">

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

</div>

### [Version 0.147.12](https://github.com/lobehub/lobe-chat/compare/v0.147.11...v0.147.12)

<sup>Released on **2024-04-14**</sup>

#### ♻ Code Refactoring

- **misc**: Move client db to a new folder.

<br/>

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

#### Code refactoring

- **misc**: Move client db to a new folder, closes [#2037](https://github.com/lobehub/lobe-chat/issues/2037) ([ebe65bb](https://github.com/lobehub/lobe-chat/commit/ebe65bb))

</details>

<div align="right">

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

</div>

### [Version 0.147.11](https://github.com/lobehub/lobe-chat/compare/v0.147.10...v0.147.11)

<sup>Released on **2024-04-14**</sup>

#### 🐛 Bug Fixes

- **misc**: Support drag or copy to upload file by model ability.

<br/>

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

#### What's fixed

- **misc**: Support drag or copy to upload file by model ability, closes [#2016](https://github.com/lobehub/lobe-chat/issues/2016) ([2abe37e](https://github.com/lobehub/lobe-chat/commit/2abe37e))

</details>

<div align="right">

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

</div>

### [Version 0.147.10](https://github.com/lobehub/lobe-chat/compare/v0.147.9...v0.147.10)

<sup>Released on **2024-04-13**</sup>
Expand Down
4 changes: 2 additions & 2 deletions contributing/Basic/Feature-Development.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ When building the LobeChat application, the Model is responsible for interacting
In `src/database/model/sessionGroup.ts`, the `SessionGroupModel` is defined as follows:

```typescript
import { BaseModel } from '@/database/core';
import { DB_SessionGroup, DB_SessionGroupSchema } from '@/database/schemas/sessionGroup';
import { BaseModel } from '@/database/client/core';
import { DB_SessionGroup, DB_SessionGroupSchema } from '@/database/client/schemas/sessionGroup';
import { nanoid } from '@/utils/uuid';

class _SessionGroupModel extends BaseModel {
Expand Down
4 changes: 2 additions & 2 deletions contributing/Basic/Feature-Development.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ export class LocalDB extends Dexie {
`src/database/model/sessionGroup.ts` 中定义 `SessionGroupModel`

```typescript
import { BaseModel } from '@/database/core';
import { DB_SessionGroup, DB_SessionGroupSchema } from '@/database/schemas/sessionGroup';
import { BaseModel } from '@/database/client/core';
import { DB_SessionGroup, DB_SessionGroupSchema } from '@/database/client/schemas/sessionGroup';
import { nanoid } from '@/utils/uuid';

class _SessionGroupModel extends BaseModel {
Expand Down
28 changes: 15 additions & 13 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,6 @@ const API_PROXY_ENDPOINT = process.env.API_PROXY_ENDPOINT || '';

const basePath = process.env.NEXT_PUBLIC_BASE_PATH;

const withBundleAnalyzer = analyzer({
enabled: process.env.ANALYZE === 'true',
});

const withPWA = nextPWA({
dest: 'public',
register: true,
workboxOptions: {
skipWaiting: true,
},
});

/** @type {import('next').NextConfig} */
const nextConfig = {
compress: isProd,
Expand Down Expand Up @@ -67,4 +55,18 @@ const nextConfig = {
},
};

export default isProd ? withBundleAnalyzer(withPWA(nextConfig)) : nextConfig;
const noWrapper = (config) => config;

const withBundleAnalyzer = process.env.ANALYZE === 'true' ? analyzer() : noWrapper;

const withPWA = isProd
? nextPWA({
dest: 'public',
register: true,
workboxOptions: {
skipWaiting: true,
},
})
: noWrapper;

export default withBundleAnalyzer(withPWA(nextConfig));
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": "0.147.10",
"version": "0.147.16",
"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
2 changes: 1 addition & 1 deletion src/app/api/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { GET, POST } from '../next-auth';
export { GET, POST } from '@/libs/next-auth';

export const runtime = 'edge'; // optional
16 changes: 14 additions & 2 deletions src/app/chat/(desktop)/features/ChatInput/Footer/DragUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import { useTranslation } from 'react-i18next';
import { Center, Flexbox } from 'react-layout-kit';

import { useFileStore } from '@/store/file';
import { useGlobalStore } from '@/store/global';
import { modelProviderSelectors } from '@/store/global/selectors';
import { useSessionStore } from '@/store/session';
import { agentSelectors } from '@/store/session/selectors';

const useStyles = createStyles(({ css, token, stylish }) => {
return {
Expand Down Expand Up @@ -56,6 +60,8 @@ const useStyles = createStyles(({ css, token, stylish }) => {
};
});



const handleDragOver = (e: DragEvent) => {
e.preventDefault();
};
Expand All @@ -71,12 +77,16 @@ const DragUpload = memo(() => {

const uploadFile = useFileStore((s) => s.uploadFile);

const model = useSessionStore(agentSelectors.currentAgentModel);

const enabledFiles = useGlobalStore(modelProviderSelectors.isModelEnabledFiles(model));

const uploadImages = async (fileList: FileList | undefined) => {
if (!fileList || fileList.length === 0) return;

const pools = Array.from(fileList).map(async (file) => {
// skip none-file items
if (!file.type.startsWith('image')) return;
if (!file.type.startsWith('image') && !enabledFiles) return;
await uploadFile(file);
});

Expand Down Expand Up @@ -126,6 +136,7 @@ const DragUpload = memo(() => {
uploadImages(files);
};


useEffect(() => {
window.addEventListener('dragenter', handleDragEnter);
window.addEventListener('dragover', handleDragOver);
Expand All @@ -140,7 +151,7 @@ const DragUpload = memo(() => {
window.removeEventListener('drop', handleDrop);
window.removeEventListener('paste', handlePaste);
};
}, []);
}, [handleDrop, handlePaste]);

return (
isDragging && (
Expand All @@ -164,3 +175,4 @@ const DragUpload = memo(() => {
});

export default DragUpload;

8 changes: 7 additions & 1 deletion src/app/chat/(desktop)/features/ChatInput/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ const useStyles = createStyles(({ css, prefixCls, token }) => {

const isMac = isMacOS();

const Footer = memo<{ setExpand?: (expand: boolean) => void }>(({ setExpand }) => {
interface FooterProps {
setExpand?: (expand: boolean) => void;
}

const Footer = memo<FooterProps>(({ setExpand }) => {
const { t } = useTranslation('chat');

const { theme, styles } = useStyles();
Expand Down Expand Up @@ -193,4 +197,6 @@ const Footer = memo<{ setExpand?: (expand: boolean) => void }>(({ setExpand }) =
);
});

Footer.displayName = 'Footer';

export default Footer;
8 changes: 7 additions & 1 deletion src/app/chat/(desktop)/features/ChatInput/TextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ const useStyles = createStyles(({ css }) => {
};
});

const InputArea = memo<{ setExpand?: (expand: boolean) => void }>(({ setExpand }) => {
interface InputAreaProps {
setExpand?: (expand: boolean) => void;
}

const InputArea = memo<InputAreaProps>(({ setExpand }) => {
const { t } = useTranslation('chat');
const { styles } = useStyles();
const ref = useRef<TextAreaRef>(null);
Expand Down Expand Up @@ -119,4 +123,6 @@ const InputArea = memo<{ setExpand?: (expand: boolean) => void }>(({ setExpand }
);
});

InputArea.displayName = 'InputArea';

export default InputArea;
4 changes: 2 additions & 2 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { isRtlLang } from 'rtl-detect';
import Analytics from '@/components/Analytics';
import { DEFAULT_LANG, LOBE_LOCALE_COOKIE } from '@/const/locale';
import AuthProvider from '@/layout/AuthProvider';
import GlobalLayout from '@/layout/GlobalLayout';
import GlobalProvider from '@/layout/GlobalProvider';
import LayoutRoutes from '@/layout/routes';
import { isMobileDevice } from '@/utils/responsive';

const RootLayout = async ({ children }: PropsWithChildren) => {
Expand All @@ -22,7 +22,7 @@ const RootLayout = async ({ children }: PropsWithChildren) => {
<body>
<GlobalProvider>
<AuthProvider>
<GlobalLayout>{children}</GlobalLayout>
<LayoutRoutes>{children}</LayoutRoutes>
</AuthProvider>
</GlobalProvider>
<Analytics />
Expand Down
3 changes: 2 additions & 1 deletion src/config/modelProviders/google.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const Google: ModelProviderCard = {
{
description: 'The best image understanding model to handle a broad range of applications',
displayName: 'Gemini 1.0 Pro Vision',
enabled: true,
id: 'gemini-1.0-pro-vision-latest',
maxOutput: 4096,
tokens: 16_384,
Expand All @@ -35,6 +34,7 @@ const Google: ModelProviderCard = {
{
description: 'The best image understanding model to handle a broad range of applications',
displayName: 'Gemini 1.0 Pro Vision',
enabled: true,
id: 'gemini-pro-vision',
maxOutput: 4096,
tokens: 16_384,
Expand All @@ -59,6 +59,7 @@ const Google: ModelProviderCard = {
{
description: 'Mid-size multimodal model that supports up to 1 million tokens',
displayName: 'Gemini 1.5 Pro',
enabled: true,
id: 'gemini-1.5-pro-latest',
maxOutput: 8192,
tokens: 1_056_768,
Expand Down
2 changes: 1 addition & 1 deletion src/config/modelProviders/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const OpenAI: ModelProviderCard = {
},
{
description: 'GPT-4 Turbo 视觉版',
displayName: 'GPT-4 Turbo Vision',
displayName: 'GPT-4 Turbo',
enabled: true,
functionCall: true,
id: 'gpt-4-turbo',
Expand Down
Loading

0 comments on commit f4a30ec

Please sign in to comment.