forked from lobehub/lobe-chat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sparkles: feat: Chat v0.1 (lobehub#7)
--------- Co-authored-by: canisminor1990 <[email protected]>
- Loading branch information
1 parent
59d381e
commit 3db700a
Showing
83 changed files
with
3,460 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,15 @@ | ||
const config = require('@umijs/lint/dist/config/eslint'); | ||
const config = require('@lobehub/lint').eslint; | ||
|
||
config.extends.push('plugin:@next/next/recommended'); | ||
//config.extends.push('plugin:@next/next/core-web-vitals'); | ||
|
||
module.exports = { | ||
...config, | ||
extends: ['plugin:@next/next/recommended'], | ||
rules: { | ||
...config.rules, | ||
'react/jsx-sort-props': 'off', | ||
'sort-keys-fix/sort-keys-fix': 'off', | ||
'typescript-sort-keys/interface': 'off', | ||
'unicorn/switch-case-braces': 'off', | ||
}, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,10 @@ | ||
module.exports = { | ||
printWidth: 100, | ||
printWidth: 120, | ||
singleQuote: true, | ||
trailingComma: 'all', | ||
proseWrap: 'never', | ||
endOfLine: 'lf', | ||
overrides: [{ files: '.prettierrc', options: { parser: 'json' } }], | ||
plugins: [ | ||
require.resolve('prettier-plugin-packagejson'), | ||
require.resolve('prettier-plugin-organize-imports'), | ||
], | ||
plugins: [require.resolve('prettier-plugin-packagejson'), require.resolve('prettier-plugin-organize-imports')], | ||
pluginSearchDirs: false, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,46 @@ | ||
<a name="readme-top"></a> | ||
|
||
<div align="center"> | ||
|
||
<img width="160" src="https://raw.githubusercontent.com/lobehub/.github/main/profile/Logo.webp"> | ||
|
||
<img height="120" src="https://npm.elemecdn.com/@lobehub/[email protected]/assets/logo-3d.webp"> | ||
<img height="120" src="https://gw.alipayobjects.com/zos/kitchen/qJ3l3EPsdW/split.svg"> | ||
<img height="120" src="https://npm.elemecdn.com/fluentui-emoji/icons/modern/robot.svg"> | ||
|
||
<h1>Lobe Chat</h1> | ||
|
||
Lobe Chat is an open-source chatgpt client | ||
|
||
Lobe Chat is an open-source chatbot client using LangChain | ||
|
||
Typescript and Next.js | ||
|
||
[Changelog](./CHANGELOG.md) · [Report Bug][issues-url] · [Request Feature][issues-url] | ||
|
||
<!-- SHIELD GROUP --> | ||
|
||
[![release][release-shield]][release-url] | ||
[![releaseDate][release-date-shield]][release-date-url] | ||
[![ciTest][ci-test-shield]][ci-test-url] | ||
[![ciRelease][ci-release-shield]][ci-release-url] | ||
<br/> | ||
[![ciRelease][ci-release-shield]][ci-release-url] <br/> | ||
[![contributors][contributors-shield]][contributors-url] | ||
[![forks][forks-shield]][forks-url] | ||
[![stargazers][stargazers-shield]][stargazers-url] | ||
[![issues][issues-shield]][issues-url] | ||
![](https://github.com/othneildrew/Best-README-Template/raw/master/images/screenshot.png) | ||
|
||
![](https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/rainbow.png) | ||
|
||
</div> | ||
|
||
<details> | ||
<summary><kbd>Table of contents</kbd></summary> | ||
|
||
#### TOC | ||
|
||
- [⌨️ Local Development](#️-local-development) | ||
- [🤝 Contributing](#-contributing) | ||
|
||
#### | ||
|
||
</details> | ||
|
||
## ⌨️ Local Development | ||
|
||
You can use Gitpod for online development: | ||
|
@@ -37,8 +52,8 @@ Or clone it for local development: | |
```bash | ||
$ git clone https://github.com/lobehub/lobe-chat.git | ||
$ cd canisminor-template | ||
$ npm install | ||
$ npm start | ||
$ pnpm install | ||
$ pnpm start | ||
``` | ||
|
||
<div align="right"> | ||
|
@@ -47,7 +62,6 @@ $ npm start | |
|
||
</div> | ||
|
||
|
||
## 🤝 Contributing | ||
|
||
<!-- CONTRIBUTION GROUP --> | ||
|
@@ -76,11 +90,11 @@ $ npm start | |
</div> | ||
|
||
--- | ||
|
||
#### 📝 License | ||
|
||
Copyright © 2023 [LobeHub][profile-url]. <br /> | ||
This project is [MIT](./LICENSE) licensed. | ||
|
||
This project is [MIT](./LICENSE) licensed. | ||
|
||
<!-- LINK GROUP --> | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// @ts-check | ||
const API_END_PORT_URL = process.env.API_END_PORT_URL || ''; | ||
|
||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
reactStrictMode: true, | ||
pageExtensions: ['page.tsx', 'api.ts'], | ||
transpilePackages: ['@lobehub/ui', 'antd-style'], | ||
webpack(config) { | ||
config.experiments = { | ||
asyncWebAssembly: true, | ||
layers: true, | ||
}; | ||
|
||
return config; | ||
}, | ||
|
||
async rewrites() { | ||
return [ | ||
{ | ||
source: '/api/openai-dev', | ||
destination: `${API_END_PORT_URL}/api/openai`, | ||
}, | ||
{ | ||
source: '/api/chain-dev', | ||
destination: `${API_END_PORT_URL}/api/chain`, | ||
}, | ||
]; | ||
}, | ||
}; | ||
|
||
export default nextConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,31 @@ | ||
{ | ||
"name": "@lobehub/chat", | ||
"version": "1.1.0", | ||
"private": true, | ||
"description": "Lobe Chat is an open-source chatbot client using LangChain, Typescript and Next.js", | ||
"keywords": [ | ||
"chatbot", | ||
"ChatGPT", | ||
"LangChain", | ||
"typescript", | ||
"Next.js" | ||
], | ||
"homepage": "https://github.com/lobehub/lobe-chat", | ||
"bugs": { | ||
"url": "https://github.com/lobehub/lobe-chat/issues/new" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/lobehub/lobe-chat.git" | ||
}, | ||
"license": "MIT", | ||
"author": "LobeHub <[email protected]>", | ||
"sideEffects": false, | ||
"scripts": { | ||
"build": "next build", | ||
"dev": "PORT=3010 next dev", | ||
"lint": "next lint && npm run ts-check && npm run stylelint", | ||
"lint": "eslint \"{src,tests}/**/*.{js,jsx,ts,tsx}\" --fix", | ||
"lint:md": "remark . --quiet --frail --output", | ||
"lint:style": "stylelint \"{src,tests}/**/*.{js,jsx,ts,tsx}\" --fix", | ||
"prepare": "husky install", | ||
"prettier": "prettier -c --write \"**/**\"", | ||
"release": "semantic-release", | ||
|
@@ -14,17 +34,61 @@ | |
"test": "vitest --passWithNoTests", | ||
"test:coverage": "vitest run --coverage --passWithNoTests", | ||
"test:update": "vitest -u", | ||
"ts-check": "tsc --noEmit" | ||
"type-check": "tsc --noEmit" | ||
}, | ||
"lint-staged": { | ||
"*.md": [ | ||
"remark --quiet --output --", | ||
"prettier --write --no-error-on-unmatched-pattern" | ||
], | ||
"*.json": [ | ||
"prettier --write --no-error-on-unmatched-pattern" | ||
], | ||
"*.{js,jsx}": [ | ||
"prettier --write", | ||
"stylelint --fix", | ||
"eslint --fix" | ||
], | ||
"*.{ts,tsx}": [ | ||
"prettier --parser=typescript --write", | ||
"stylelint --fix", | ||
"eslint --fix" | ||
] | ||
}, | ||
"dependencies": { | ||
"@lobehub/ui": "^1", | ||
"@ant-design/colors": "^7", | ||
"@ant-design/icons": "^5", | ||
"@commitlint/cli": "^17", | ||
"@lobehub/ui": "latest", | ||
"@vercel/analytics": "^1", | ||
"ahooks": "^3", | ||
"antd": "^5", | ||
"antd-style": "^3", | ||
"brotli-wasm": "^1", | ||
"chroma-js": "^2", | ||
"fast-deep-equal": "^3", | ||
"gpt-tokenizer": "^2", | ||
"i18next": "^23", | ||
"immer": "^10", | ||
"langchain": "latest", | ||
"next": "^13", | ||
"lodash-es": "^4", | ||
"lucide-react": "latest", | ||
"nanoid": "^4", | ||
"next": "13.4.7", | ||
"polished": "^4", | ||
"react": "^18", | ||
"react-dom": "^18" | ||
"react-dom": "^18", | ||
"react-hotkeys-hook": "^4", | ||
"react-i18next": "^13", | ||
"react-layout-kit": "^1", | ||
"swr": "^2", | ||
"ts-md5": "^1", | ||
"zustand": "^4", | ||
"zustand-utils": "^1" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^17", | ||
"@lobehub/lint": "^1", | ||
"@next/eslint-plugin-next": "^13", | ||
"@testing-library/jest-dom": "^5", | ||
"@testing-library/react": "^14", | ||
|
@@ -36,7 +100,8 @@ | |
"@types/testing-library__jest-dom": "^5", | ||
"@types/uuid": "^9", | ||
"@umijs/lint": "^4", | ||
"@vitest/coverage-c8": "latest", | ||
"@vitest/coverage-v8": "latest", | ||
"commitlint": "^17", | ||
"eslint": "^8", | ||
"husky": "^8", | ||
"jsdom": "^22", | ||
|
@@ -50,9 +115,6 @@ | |
"semantic-release": "^21", | ||
"semantic-release-config-gitmoji": "^1", | ||
"stylelint": "^15", | ||
"stylelint-config-clean-order": "^5", | ||
"stylelint-config-recommended": "^12", | ||
"stylelint-order": "^6", | ||
"typescript": "^5", | ||
"vitest": "latest" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const OPENAI_SERVICE_ERROR_CODE = 555; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { LanguageModel } from '@/types/llm'; | ||
|
||
export const ModelTokens: Record<LanguageModel, number> = { | ||
[LanguageModel.GPT3_5]: 4096, | ||
[LanguageModel.GPT3_5_16K]: 4096 * 4, | ||
[LanguageModel.GPT4]: 8196, | ||
[LanguageModel.GPT4_32K]: 8196 * 4, | ||
}; |
Oops, something went wrong.