@lobehub/chat 1.8.0 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.dockerignore CHANGED
@@ -4,7 +4,6 @@ node_modules
4
4
  npm-debug.log
5
5
  .next
6
6
  .git
7
- scripts
8
7
  docs
9
8
  .github
10
9
  *.md
@@ -6,9 +6,10 @@
6
6
  - [ ] 🐛 fix
7
7
  - [ ] ♻️ refactor
8
8
  - [ ] 💄 style
9
- - [ ] 🔨 chore
9
+ - [ ] 👷 build
10
10
  - [ ] ⚡️ perf
11
11
  - [ ] 📝 docs
12
+ - [ ] 🔨 chore
12
13
 
13
14
  #### 🔀 变更说明 | Description of Change
14
15
 
@@ -0,0 +1,46 @@
1
+ name: Publish Database Docker Image
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ release:
6
+ types: [published]
7
+
8
+ jobs:
9
+ push_to_registry:
10
+ name: Push Docker image to Docker Hub
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Check out the repo
14
+ uses: actions/checkout@v4
15
+ - name: Log in to Docker Hub
16
+ uses: docker/login-action@v3
17
+ with:
18
+ username: ${{ secrets.DOCKER_REGISTRY_USER }}
19
+ password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
20
+
21
+ - name: Extract metadata (tags, labels) for Docker
22
+ id: meta
23
+ uses: docker/metadata-action@v5
24
+ with:
25
+ images: lobehub/lobe-chat-database
26
+ tags: |
27
+ type=raw,value=latest
28
+ type=ref,event=tag
29
+
30
+ - name: Set up QEMU
31
+ uses: docker/setup-qemu-action@v3
32
+
33
+ - name: Set up Docker Buildx
34
+ uses: docker/setup-buildx-action@v3
35
+
36
+ - name: Build and push Docker image
37
+ uses: docker/build-push-action@v5
38
+ with:
39
+ context: .
40
+ file: ./Dockerfile.database # 指定使用 Dockerfile.database 文件
41
+ platforms: linux/amd64,linux/arm64
42
+ push: true
43
+ tags: ${{ steps.meta.outputs.tags }}
44
+ labels: ${{ steps.meta.outputs.labels }}
45
+ cache-from: type=gha
46
+ cache-to: type=gha,mode=max
package/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.8.1](https://github.com/lobehub/lobe-chat/compare/v1.8.0...v1.8.1)
6
+
7
+ <sup>Released on **2024-08-03**</sup>
8
+
9
+ #### 💄 Styles
10
+
11
+ - **misc**: Fix `aya`, `mathstral` model tag icon & update ollama model info.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Styles
19
+
20
+ - **misc**: Fix `aya`, `mathstral` model tag icon & update ollama model info, closes [#3382](https://github.com/lobehub/lobe-chat/issues/3382) ([ced95a8](https://github.com/lobehub/lobe-chat/commit/ced95a8))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
5
30
  ## [Version 1.8.0](https://github.com/lobehub/lobe-chat/compare/v1.7.10...v1.8.0)
6
31
 
7
32
  <sup>Released on **2024-08-02**</sup>
@@ -0,0 +1,170 @@
1
+ ## Base image for all the stages
2
+ FROM node:20-alpine AS base
3
+
4
+ RUN \
5
+ # Add user nextjs to run the app
6
+ addgroup --system --gid 1001 nodejs \
7
+ && adduser --system --uid 1001 nextjs
8
+
9
+ ## Builder image, install all the dependencies and build the app
10
+ FROM base AS builder
11
+
12
+ ARG USE_NPM_CN_MIRROR
13
+
14
+ ENV KEY_VAULTS_SECRET="use-for-build" \
15
+ NEXT_PUBLIC_SERVICE_MODE="server" \
16
+ DATABASE_DRIVER="node" \
17
+ DATABASE_URL="postgres://postgres:password@localhost:5432/postgres"
18
+
19
+ # Sentry
20
+ ENV NEXT_PUBLIC_SENTRY_DSN="" \
21
+ SENTRY_ORG="" \
22
+ SENTRY_PROJECT=""
23
+
24
+ # Posthog
25
+ ENV NEXT_PUBLIC_ANALYTICS_POSTHOG="" \
26
+ NEXT_PUBLIC_POSTHOG_HOST="" \
27
+ NEXT_PUBLIC_POSTHOG_KEY=""
28
+
29
+ # Umami
30
+ ENV NEXT_PUBLIC_ANALYTICS_UMAMI="" \
31
+ NEXT_PUBLIC_UMAMI_SCRIPT_URL="" \
32
+ NEXT_PUBLIC_UMAMI_WEBSITE_ID=""
33
+
34
+ # Node
35
+ ENV NODE_OPTIONS="--max-old-space-size=8192"
36
+
37
+ WORKDIR /app
38
+
39
+ COPY package.json ./
40
+ COPY .npmrc ./
41
+
42
+ RUN \
43
+ # If you want to build docker in China, build with --build-arg USE_NPM_CN_MIRROR=true
44
+ if [ "${USE_NPM_CN_MIRROR:-false}" = "true" ]; then \
45
+ export SENTRYCLI_CDNURL="https://npmmirror.com/mirrors/sentry-cli"; \
46
+ npm config set registry "https://registry.npmmirror.com/"; \
47
+ fi \
48
+ # Set the registry for corepack
49
+ && export COREPACK_NPM_REGISTRY=$(npm config get registry | sed 's/\/$//') \
50
+ # Enable corepack
51
+ && corepack enable \
52
+ # Use pnpm for corepack
53
+ && corepack use pnpm \
54
+ # Install the dependencies
55
+ && pnpm i \
56
+ # Add sharp and db migration dependencies
57
+ && mkdir -p /deps \
58
+ && pnpm add sharp pg drizzle-orm --prefix /deps
59
+
60
+ COPY . .
61
+
62
+ # run build standalone for docker version
63
+ RUN npm run build:docker
64
+
65
+ ## Application image, copy all the files for production
66
+ FROM scratch AS app
67
+
68
+ COPY --from=builder /app/public /app/public
69
+
70
+ # Automatically leverage output traces to reduce image size
71
+ # https://nextjs.org/docs/advanced-features/output-file-tracing
72
+ COPY --from=builder /app/.next/standalone /app/
73
+ COPY --from=builder /app/.next/static /app/.next/static
74
+
75
+ # copy dependencies
76
+ COPY --from=builder /deps/node_modules/.pnpm /app/node_modules/.pnpm
77
+ COPY --from=builder /deps/node_modules/pg /app/node_modules/pg
78
+ COPY --from=builder /deps/node_modules/drizzle-orm /app/node_modules/drizzle-orm
79
+
80
+ # Copy database migrations
81
+ COPY --from=builder /app/src/database/server/migrations /app/migrations
82
+ COPY --from=builder /app/scripts/migrateServerDB/docker.cjs /app/docker.cjs
83
+
84
+ ## Production image, copy all the files and run next
85
+ FROM base
86
+
87
+ # Copy all the files from app, set the correct permission for prerender cache
88
+ COPY --from=app --chown=nextjs:nodejs /app /app
89
+
90
+ ENV NODE_ENV="production"
91
+
92
+ # set hostname to localhost
93
+ ENV HOSTNAME="0.0.0.0" \
94
+ PORT="3210"
95
+
96
+ # General Variables
97
+ ENV API_KEY_SELECT_MODE="" \
98
+ FEATURE_FLAGS=""
99
+
100
+ # Database
101
+ ENV KEY_VAULTS_SECRET="" \
102
+ DATABASE_DRIVER="node" \
103
+ DATABASE_URL=""
104
+
105
+ # Next Auth
106
+ ENV NEXT_AUTH_SECRET="" \
107
+ ACCESS_CODE="" \
108
+ NEXTAUTH_URL="" \
109
+ NEXT_AUTH_SSO_PROVIDERS=""
110
+
111
+ # S3
112
+ ENV S3_ACCESS_KEY_ID="" \
113
+ S3_SECRET_ACCESS_KEY="" \
114
+ NEXT_PUBLIC_S3_DOMAIN="" \
115
+ S3_ENDPOINT="" \
116
+ S3_BUCKET=""
117
+
118
+ # Model Variables
119
+ ENV \
120
+ # Ai360
121
+ AI360_API_KEY="" \
122
+ # Anthropic
123
+ ANTHROPIC_API_KEY="" ANTHROPIC_PROXY_URL="" \
124
+ # Amazon Bedrock
125
+ AWS_ACCESS_KEY_ID="" AWS_SECRET_ACCESS_KEY="" AWS_REGION="" \
126
+ # Azure OpenAI
127
+ AZURE_API_KEY="" AZURE_API_VERSION="" AZURE_ENDPOINT="" AZURE_MODEL_LIST="" \
128
+ # Baichuan
129
+ BAICHUAN_API_KEY="" \
130
+ # DeepSeek
131
+ DEEPSEEK_API_KEY="" \
132
+ # Google
133
+ GOOGLE_API_KEY="" GOOGLE_PROXY_URL="" \
134
+ # Groq
135
+ GROQ_API_KEY="" GROQ_PROXY_URL="" \
136
+ # Minimax
137
+ MINIMAX_API_KEY="" \
138
+ # Mistral
139
+ MISTRAL_API_KEY="" \
140
+ # Moonshot
141
+ MOONSHOT_API_KEY="" MOONSHOT_PROXY_URL="" \
142
+ # Novita
143
+ NOVITA_API_KEY="" \
144
+ # Ollama
145
+ OLLAMA_MODEL_LIST="" OLLAMA_PROXY_URL="" \
146
+ # OpenAI
147
+ OPENAI_API_KEY="" OPENAI_MODEL_LIST="" OPENAI_PROXY_URL="" \
148
+ # OpenRouter
149
+ OPENROUTER_API_KEY="" OPENROUTER_MODEL_LIST="" \
150
+ # Perplexity
151
+ PERPLEXITY_API_KEY="" PERPLEXITY_PROXY_URL="" \
152
+ # Qwen
153
+ QWEN_API_KEY="" \
154
+ # Stepfun
155
+ STEPFUN_API_KEY="" \
156
+ # Taichu
157
+ TAICHU_API_KEY="" \
158
+ # TogetherAI
159
+ TOGETHERAI_API_KEY="" TOGETHERAI_MODEL_LIST="" \
160
+ # 01.AI
161
+ ZEROONE_API_KEY="" \
162
+ # Zhipu
163
+ ZHIPU_API_KEY=""
164
+
165
+ USER nextjs
166
+
167
+ EXPOSE 3210/tcp
168
+
169
+ # run migration , then run app
170
+ CMD ["sh", "-c", "node /app/docker.cjs && node /app/server.js"]
package/README.md CHANGED
@@ -266,14 +266,14 @@ Our marketplace is not just a showcase platform but also a collaborative space.
266
266
 
267
267
  <!-- AGENT LIST -->
268
268
 
269
- | Recent Submits | Description |
270
- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
271
- | [Code Snark Master](https://chat-preview.lobehub.com/market?agent=code-snark-master)<br/><sup>By **[leter](https://github.com/leter)** on **2024-07-29**</sup> | Specializes in sharp criticism of code, sarcastically pointing out inefficiencies and readability issues<br/>`tech-leadership` `code-review` `sarcastic-style` `programming-consultation` |
272
- | [Unity Maestro](https://chat-preview.lobehub.com/market?agent=unity-maestro)<br/><sup>By **[thedivergentai](https://github.com/thedivergentai)** on **2024-07-29**</sup> | Expert Unity Game Development Companion<br/>`game-development` `unity` `software-engineering` |
273
- | [C Program Learning Assistant](https://chat-preview.lobehub.com/market?agent=sichuan-university-941-c-programming-assistant)<br/><sup>By **[YBGuoYang](https://github.com/YBGuoYang)** on **2024-07-28**</sup> | Assist me in learning C program design<br/>`941` |
274
- | [Brand Pioneer](https://chat-preview.lobehub.com/market?agent=brand-pioneer)<br/><sup>By **[SaintFresh](https://github.com/SaintFresh)** on **2024-07-25**</sup> | A brand development specialist, thought leader, brand strategy super-genius, and brand visionary. Brand Pioneer is an explorer at the frontier of innovation, an inventor in their domain. Provide them with your market and let them imagine a future world characterized by groundbreaking advancements in your field of expertise.<br/>`business` `brand-pioneer` `brand-development` `business-assistant` `brand-narrative` |
275
-
276
- > 📊 Total agents: [<kbd>**309**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
269
+ | Recent Submits | Description |
270
+ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
271
+ | [Omnipedia](https://chat-preview.lobehub.com/market?agent=omnipedia)<br/><sup>By **[thedivergentai](https://github.com/thedivergentai)** on **2024-08-02**</sup> | Expert in providing high-quality, well-researched information on various topics, including history, science, literature, art, and more. Skilled in summarizing complex topics, assisting with research tasks, and offering creative prompts<br/>`artificial-intelligence` `information` `education` `communication` |
272
+ | [Code Snark Master](https://chat-preview.lobehub.com/market?agent=code-snark-master)<br/><sup>By **[leter](https://github.com/leter)** on **2024-07-29**</sup> | Specializes in sharp criticism of code, sarcastically pointing out inefficiencies and readability issues<br/>`tech-leadership` `code-review` `sarcastic-style` `programming-consultation` |
273
+ | [Unity Maestro](https://chat-preview.lobehub.com/market?agent=unity-maestro)<br/><sup>By **[thedivergentai](https://github.com/thedivergentai)** on **2024-07-29**</sup> | Expert Unity Game Development Companion<br/>`game-development` `unity` `software-engineering` |
274
+ | [C Program Learning Assistant](https://chat-preview.lobehub.com/market?agent=sichuan-university-941-c-programming-assistant)<br/><sup>By **[YBGuoYang](https://github.com/YBGuoYang)** on **2024-07-28**</sup> | Assist me in learning C program design<br/>`941` |
275
+
276
+ > 📊 Total agents: [<kbd>**310**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
277
277
 
278
278
  <!-- AGENT LIST -->
279
279
 
package/README.zh-CN.md CHANGED
@@ -254,14 +254,14 @@ LobeChat 的插件生态系统是其核心功能的重要扩展,它极大地
254
254
 
255
255
  <!-- AGENT LIST -->
256
256
 
257
- | 最近新增 | 助手说明 |
258
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
259
- | [代码毒舌大师](https://chat-preview.lobehub.com/market?agent=code-snark-master)<br/><sup>By **[leter](https://github.com/leter)** on **2024-07-29**</sup> | 擅长尖刻批评代码,讽刺性地指出低效和可读性问题<br/>`技术领导` `代码审查` `讽刺风格` `编程咨询` |
260
- | [Unity Maestro](https://chat-preview.lobehub.com/market?agent=unity-maestro)<br/><sup>By **[thedivergentai](https://github.com/thedivergentai)** on **2024-07-29**</sup> | Expert Unity Game Development Companion<br/>`game-development` `unity` `software-engineering` |
261
- | [c 程序学习助手](https://chat-preview.lobehub.com/market?agent=sichuan-university-941-c-programming-assistant)<br/><sup>By **[YBGuoYang](https://github.com/YBGuoYang)** on **2024-07-28**</sup> | 辅助我进行 c 程序设计的学习<br/>`941` |
262
- | [品牌先锋](https://chat-preview.lobehub.com/market?agent=brand-pioneer)<br/><sup>By **[SaintFresh](https://github.com/SaintFresh)** on **2024-07-25**</sup> | 一位品牌发展专家、思想领袖、品牌战略超级天才和品牌远见者。品牌先锋是创新前沿的探险家,在其领域是一位发明家。将您的市场提供给他们,让他们想象一个未来世界,其中以您的专业领域的突破性进展为特征。<br/>`商业` `品牌先锋` `品牌发展` `商业助手` `品牌叙事` |
263
-
264
- > 📊 Total agents: [<kbd>**309**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
257
+ | 最近新增 | 助手说明 |
258
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
259
+ | [Omnipedia](https://chat-preview.lobehub.com/market?agent=omnipedia)<br/><sup>By **[thedivergentai](https://github.com/thedivergentai)** on **2024-08-02**</sup> | 专业提供高质量、深入研究的各种主题信息,包括历史、科学、文学、艺术等。擅长总结复杂主题,协助研究任务,并提供创意启示。<br/>`artificial-intelligence` `information` `education` `communication` |
260
+ | [代码毒舌大师](https://chat-preview.lobehub.com/market?agent=code-snark-master)<br/><sup>By **[leter](https://github.com/leter)** on **2024-07-29**</sup> | 擅长尖刻批评代码,讽刺性地指出低效和可读性问题<br/>`技术领导` `代码审查` `讽刺风格` `编程咨询` |
261
+ | [Unity Maestro](https://chat-preview.lobehub.com/market?agent=unity-maestro)<br/><sup>By **[thedivergentai](https://github.com/thedivergentai)** on **2024-07-29**</sup> | Expert Unity Game Development Companion<br/>`game-development` `unity` `software-engineering` |
262
+ | [c 程序学习助手](https://chat-preview.lobehub.com/market?agent=sichuan-university-941-c-programming-assistant)<br/><sup>By **[YBGuoYang](https://github.com/YBGuoYang)** on **2024-07-28**</sup> | 辅助我进行 c 程序设计的学习<br/>`941` |
263
+
264
+ > 📊 Total agents: [<kbd>**310**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
265
265
 
266
266
  <!-- AGENT LIST -->
267
267
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
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.",
5
5
  "keywords": [
6
6
  "framework",
@@ -0,0 +1,34 @@
1
+ const { join } = require('node:path');
2
+ const { Pool } = require('pg');
3
+ const { drizzle } = require('drizzle-orm/node-postgres');
4
+ const migrator = require('drizzle-orm/node-postgres/migrator');
5
+
6
+ if (!process.env.DATABASE_URL) {
7
+ throw new Error('DATABASE_URL is not set, please set it in your environment variables.');
8
+ }
9
+
10
+ const client = new Pool({ connectionString: process.env.DATABASE_URL });
11
+
12
+ const db = drizzle(client);
13
+
14
+ const runMigrations = async () => {
15
+ console.log('[Database] Start to migration...');
16
+ await migrator.migrate(db, {
17
+ migrationsFolder: join(__dirname, './migrations'),
18
+ });
19
+
20
+ console.log('✅ database migration pass.');
21
+ console.log('-------------------------------------');
22
+ // eslint-disable-next-line unicorn/no-process-exit
23
+ process.exit(0);
24
+ };
25
+
26
+ // eslint-disable-next-line unicorn/prefer-top-level-await
27
+ runMigrations().catch((err) => {
28
+ console.error(
29
+ '❌ Database migrate failed. Please check your database is valid and DATABASE_URL is set correctly. The error detail is below:',
30
+ );
31
+ console.error(err);
32
+ // eslint-disable-next-line unicorn/no-process-exit
33
+ process.exit(1);
34
+ });
@@ -4,6 +4,7 @@ import {
4
4
  Ai21,
5
5
  Ai360,
6
6
  Aws,
7
+ Aya,
7
8
  Azure,
8
9
  Baichuan,
9
10
  ByteDance,
@@ -62,11 +63,12 @@ const ModelIcon = memo<ModelProviderIconProps>(({ model: originModel, size = 12
62
63
  if (model.includes('moonshot')) return <Moonshot.Avatar size={size} />;
63
64
  if (model.includes('qwen')) return <Tongyi.Avatar background={Tongyi.colorPrimary} size={size} />;
64
65
  if (model.includes('minmax') || model.includes('abab')) return <Minimax.Avatar size={size} />;
65
- if (model.includes('mistral') || model.includes('mixtral') || model.includes('codestral')) return <Mistral.Avatar size={size} />;
66
+ if (model.includes('mistral') || model.includes('mixtral') || model.includes('codestral') || model.includes('mathstral')) return <Mistral.Avatar size={size} />;
66
67
  if (model.includes('pplx') || model.includes('sonar')) return <Perplexity.Avatar size={size} />;
67
68
  if (model.includes('yi-')) return <Yi.Avatar size={size} />;
68
69
  if (model.startsWith('openrouter')) return <OpenRouter.Avatar size={size} />; // only for Cinematika and Auto
69
70
  if (model.startsWith('openchat')) return <OpenChat.Avatar size={size} />;
71
+ if (model.includes('aya')) return <Aya.Avatar size={size} />;
70
72
  if (model.includes('command')) return <Cohere.Avatar size={size} />;
71
73
  if (model.includes('dbrx')) return <Dbrx.Avatar size={size} />;
72
74
  if (model.includes('step')) return <Stepfun.Avatar size={size} />;
@@ -96,8 +98,7 @@ const ModelIcon = memo<ModelProviderIconProps>(({ model: originModel, size = 12
96
98
  )
97
99
  return <Stability.Avatar size={size} />;
98
100
 
99
- if (model.includes('wizardlm')) return <Azure.Avatar size={size} />;
100
- if (model.includes('phi3') || model.includes('phi-3')) return <Azure.Avatar size={size} />;
101
+ if (model.includes('phi3') || model.includes('phi-3') || model.includes('wizardlm')) return <Azure.Avatar size={size} />;
101
102
  if (model.includes('firefly')) return <Adobe.Avatar size={size} />;
102
103
  if (model.includes('jamba') || model.includes('j2-')) return <Ai21.Avatar size={size} />;
103
104
  });
@@ -4,6 +4,7 @@ import {
4
4
  Ai360,
5
5
  AiMass,
6
6
  Aws,
7
+ Aya,
7
8
  Azure,
8
9
  Baichuan,
9
10
  ByteDance,
@@ -62,11 +63,12 @@ const ModelIcon = memo<ModelIconProps>(({ model: originModel, size = 12 }) => {
62
63
  if (model.includes('qwen')) return <Tongyi size={size} />;
63
64
  if (model.includes('minmax')) return <Minimax size={size} />;
64
65
  if (model.includes('abab')) return <Minimax size={size} />;
65
- if (model.includes('mistral') || model.includes('mixtral') || model.includes('codestral')) return <Mistral size={size} />;
66
+ if (model.includes('mistral') || model.includes('mixtral') || model.includes('codestral') || model.includes('mathstral')) return <Mistral size={size} />;
66
67
  if (model.includes('pplx') || model.includes('sonar')) return <Perplexity size={size} />;
67
68
  if (model.includes('yi-')) return <Yi size={size} />;
68
69
  if (model.startsWith('openrouter')) return <OpenRouter size={size} />; // only for Cinematika and Auto
69
70
  if (model.startsWith('openchat')) return <OpenChat size={size} />;
71
+ if (model.includes('aya')) return <Aya.Avatar size={size} />;
70
72
  if (model.includes('command')) return <Cohere size={size} />;
71
73
  if (model.includes('dbrx')) return <Dbrx size={size} />;
72
74
  if (model.includes('step')) return <Stepfun size={size} />;
@@ -95,8 +97,7 @@ const ModelIcon = memo<ModelIconProps>(({ model: originModel, size = 12 }) => {
95
97
  )
96
98
  return <Stability size={size} />;
97
99
 
98
- if (model.includes('wizardlm')) return <Azure size={size} />;
99
- if (model.includes('phi3') || model.includes('phi-3')) return <Azure size={size} />;
100
+ if (model.includes('phi3') || model.includes('phi-3') || model.includes('wizardlm')) return <Azure.Avatar size={size} />;
100
101
  if (model.includes('firefly')) return <AdobeFirefly size={size} />;
101
102
  if (model.includes('jamba') || model.includes('j2-')) return <Ai21 size={size} />;
102
103
  });
@@ -37,6 +37,7 @@ const Bedrock: ModelProviderCard = {
37
37
  'Claude 3 Opus 是 Anthropic 最强大的人工智能模型,在处理高度复杂的任务方面具备顶尖性能。该模型能够以非凡的流畅性和类似人类的理解能力引导开放式的提示和未可见的场景。Claude 3 Opus 向我们展示生成式人工智能的美好前景。 Claude 3 Opus 可以处理图像和返回文本输出,并且提供 200K 上下文窗口。',
38
38
  displayName: 'Claude 3 Opus',
39
39
  enabled: true,
40
+ functionCall: true,
40
41
  id: 'anthropic.claude-3-opus-20240229-v1:0',
41
42
  tokens: 200_000,
42
43
  vision: true,
@@ -46,6 +47,7 @@ const Bedrock: ModelProviderCard = {
46
47
  'Anthropic 推出的 Claude 3 Sonnet 模型在智能和速度之间取得理想的平衡,尤其是在处理企业工作负载方面。该模型提供最大的效用,同时价格低于竞争产品,并且其经过精心设计,是大规模部署人工智能的可信赖、高耐久性骨干模型。 Claude 3 Sonnet 可以处理图像和返回文本输出,并且提供 200K 上下文窗口。',
47
48
  displayName: 'Claude 3 Sonnet',
48
49
  enabled: true,
50
+ functionCall: true,
49
51
  id: 'anthropic.claude-3-sonnet-20240229-v1:0',
50
52
  tokens: 200_000,
51
53
  vision: true,
@@ -55,6 +57,7 @@ const Bedrock: ModelProviderCard = {
55
57
  'Claude 3.5 Sonnet 提高了行业的智能标准, 在广泛的基准测试中超越了竞争对手模型以及 Claude 3 Opus, 以中端模型的速度和成本,展现出卓越性能。 Claude 3.5 Sonnet 可以处理图像和返回文本输出,并且提供 200K 上下文窗口。',
56
58
  displayName: 'Claude 3.5 Sonnet',
57
59
  enabled: true,
60
+ functionCall: true,
58
61
  id: 'anthropic.claude-3-5-sonnet-20240620-v1:0',
59
62
  tokens: 200_000,
60
63
  vision: true,
@@ -64,6 +67,7 @@ const Bedrock: ModelProviderCard = {
64
67
  'Claude 3 Haiku 是 Anthropic 最快速、最紧凑的模型,具有近乎即时的响应能力。该模型可以快速回答简单的查询和请求。客户将能够构建模仿人类交互的无缝人工智能体验。 Claude 3 Haiku 可以处理图像和返回文本输出,并且提供 200K 上下文窗口。',
65
68
  displayName: 'Claude 3 Haiku',
66
69
  enabled: true,
70
+ functionCall: true,
67
71
  id: 'anthropic.claude-3-haiku-20240307-v1:0',
68
72
  tokens: 200_000,
69
73
  vision: true,
@@ -4,65 +4,52 @@ import { ModelProviderCard } from '@/types/llm';
4
4
  const Ollama: ModelProviderCard = {
5
5
  chatModels: [
6
6
  {
7
- displayName: 'Llama3 8B',
7
+ displayName: 'Llama3.1 8B',
8
8
  enabled: true,
9
- id: 'llama3',
10
- tokens: 8000, // https://huggingface.co/blog/zh/llama3#llama-3-的新进展
11
- },
12
- {
13
- displayName: 'Llama3 70B',
14
- id: 'llama3:70b',
15
- tokens: 8000,
9
+ id: 'llama3.1',
10
+ tokens: 128_000,
16
11
  },
17
12
  {
18
- displayName: 'Phi-3 3.8B',
19
- enabled: true,
20
- id: 'phi3',
13
+ displayName: 'Llama3.1 70B',
14
+ id: 'llama3.1:70b',
21
15
  tokens: 128_000,
22
16
  },
23
17
  {
24
- displayName: 'Phi-3 14B',
25
- id: 'phi3:14b',
18
+ displayName: 'Llama3.1 405B',
19
+ id: 'llama3.1:405b',
26
20
  tokens: 128_000,
27
21
  },
28
22
  {
29
- displayName: 'Aya 23 8B',
23
+ displayName: 'Code Llama 7B',
30
24
  enabled: true,
31
- id: 'aya',
32
- tokens: 8192, // https://cohere.com/research/papers/aya-command-23-8b-and-35b-technical-report-2024-05-23
33
- },
34
- {
35
- displayName: 'Aya 23 35B',
36
- id: 'aya:35b',
37
- tokens: 8192,
25
+ id: 'codellama',
26
+ tokens: 16_384,
38
27
  },
39
28
  {
40
- displayName: 'Qwen2 7B',
41
- enabled: true,
42
- id: 'qwen2',
43
- tokens: 128_000,
29
+ displayName: 'Code Llama 13B',
30
+ id: 'codellama:13b',
31
+ tokens: 16_384,
44
32
  },
45
33
  {
46
- displayName: 'Qwen2 72B',
47
- id: 'qwen2:72b',
48
- tokens: 128_000,
34
+ displayName: 'Code Llama 34B',
35
+ id: 'codellama:34b',
36
+ tokens: 16_384,
49
37
  },
50
38
  {
51
- displayName: 'Command R 35B',
52
- enabled: true,
53
- id: 'command-r',
54
- tokens: 131_072, // https://huggingface.co/CohereForAI/c4ai-command-r-v01/blob/main/config.json
39
+ displayName: 'Code Llama 70B',
40
+ id: 'codellama:70b',
41
+ tokens: 16_384,
55
42
  },
56
43
  {
57
- displayName: 'Command R+ 104B (Q2_K)',
58
- id: 'command-r-plus:104b-q2_K',
59
- tokens: 131_072, // https://huggingface.co/CohereForAI/c4ai-command-r-plus/blob/main/config.json
44
+ displayName: 'Gemma2 2B',
45
+ id: 'gemma2:2b',
46
+ tokens: 8192,
60
47
  },
61
48
  {
62
49
  displayName: 'Gemma2 9B',
63
50
  enabled: true,
64
51
  id: 'gemma2',
65
- tokens: 8192, // https://huggingface.co/blog/zh/gemma2
52
+ tokens: 8192,
66
53
  },
67
54
  {
68
55
  displayName: 'Gemma2 27B',
@@ -70,134 +57,156 @@ const Ollama: ModelProviderCard = {
70
57
  tokens: 8192,
71
58
  },
72
59
  {
73
- displayName: 'Gemma 7B',
74
- id: 'gemma',
75
- tokens: 8192, // https://huggingface.co/google/gemma-7b-it/discussions/73#65e9678c0cda621164a95bad
60
+ displayName: 'CodeGemma 2B',
61
+ id: 'codegemma:2b',
62
+ tokens: 8192,
76
63
  },
77
64
  {
78
- displayName: 'Gemma 2B',
79
- id: 'gemma:2b',
65
+ displayName: 'CodeGemma 7B',
66
+ enabled: true,
67
+ id: 'codegemma',
80
68
  tokens: 8192,
81
69
  },
82
70
  {
83
- displayName: 'Deepseek V2 16B',
71
+ displayName: 'Phi-3 3.8B',
84
72
  enabled: true,
85
- id: 'deepseek-v2',
86
- tokens: 32_000,
73
+ id: 'phi3',
74
+ tokens: 128_000,
87
75
  },
88
76
  {
89
- displayName: 'Deepseek V2 236B',
90
- id: 'deepseek-v2:236b',
77
+ displayName: 'Phi-3 14B',
78
+ id: 'phi3:14b',
91
79
  tokens: 128_000,
92
80
  },
93
81
  {
94
- displayName: 'Deepseek Coder V2 16B', // https://huggingface.co/deepseek-ai/DeepSeek-Coder-V2-Lite-Instruct
82
+ displayName: 'WizardLM 2 7B',
95
83
  enabled: true,
96
- id: 'deepseek-coder-v2',
97
- tokens: 128_000,
84
+ id: 'wizardlm2',
85
+ tokens: 32_768,
98
86
  },
99
87
  {
100
- displayName: 'Deepseek Coder V2 236B', // https://huggingface.co/deepseek-ai/DeepSeek-Coder-V2-Lite-Instruct
101
- id: 'deepseek-coder-v2:236b',
102
- tokens: 128_000,
88
+ displayName: 'WizardLM 2 8x22B',
89
+ id: 'wizardlm2:8x22b',
90
+ tokens: 65_536,
103
91
  },
104
92
  {
105
- displayName: 'Llama2 Chat 13B',
106
- id: 'llama2:13b',
107
- tokens: 4096, // https://llama.meta.com/llama2/
93
+ displayName: 'MathΣtral 7B',
94
+ enabled: true,
95
+ id: 'mathstral',
96
+ tokens: 32_768,
108
97
  },
109
98
  {
110
- displayName: 'Llama2 Chat 7B',
111
- id: 'llama2',
112
- tokens: 4096,
99
+ displayName: 'Mistral 7B',
100
+ enabled: true,
101
+ id: 'mistral',
102
+ tokens: 32_768,
113
103
  },
114
104
  {
115
- displayName: 'Llama2 Chat 70B',
116
- id: 'llama2:70b',
117
- tokens: 4096,
105
+ displayName: 'Mixtral 8x7B',
106
+ enabled: true,
107
+ id: 'mixtral',
108
+ tokens: 32_768,
118
109
  },
119
110
  {
120
- displayName: 'Llama2 CN 13B',
121
- id: 'llama2-chinese:13b',
122
- tokens: 4096,
111
+ displayName: 'Mixtral 8x22B',
112
+ id: 'mixtral:8x22b',
113
+ tokens: 65_536,
123
114
  },
124
115
  {
125
- displayName: 'Llama2 CN 7B',
126
- id: 'llama2-chinese',
127
- tokens: 4096,
116
+ displayName: 'Mixtral Large 123B',
117
+ enabled: true,
118
+ id: 'mistral-large',
119
+ tokens: 128_000,
128
120
  },
129
121
  {
130
- displayName: 'WizardLM 2 7B',
122
+ displayName: 'Mixtral Nemo 12B',
131
123
  enabled: true,
132
- id: 'wizardlm2',
133
- tokens: 65_536,
124
+ id: 'mistral-nemo',
125
+ tokens: 128_000,
134
126
  },
135
127
  {
136
- displayName: 'WizardLM 2 8x22B',
137
- id: 'wizardlm2:8x22b',
138
- tokens: 65_536,
128
+ displayName: 'Codestral 22B',
129
+ enabled: true,
130
+ id: 'codestral',
131
+ tokens: 32_768,
139
132
  },
140
133
  {
141
- displayName: 'Code Llama 7B',
142
- id: 'codellama',
143
- tokens: 16_384, // https://huggingface.co/codellama/CodeLlama-7b-hf/blob/main/config.json
134
+ displayName: 'Aya 23 8B',
135
+ enabled: true,
136
+ id: 'aya',
137
+ tokens: 8192,
144
138
  },
145
139
  {
146
- displayName: 'Code Llama 34B',
147
- id: 'codellama:34b',
148
- tokens: 16_384,
140
+ displayName: 'Aya 23 35B',
141
+ id: 'aya:35b',
142
+ tokens: 8192,
149
143
  },
150
144
  {
151
- displayName: 'Code Llama 70B',
152
- id: 'codellama:70b',
153
- tokens: 16_384,
145
+ displayName: 'Command R 35B',
146
+ enabled: true,
147
+ id: 'command-r',
148
+ tokens: 131_072,
154
149
  },
155
150
  {
156
- displayName: 'Code Llama 7B (Python)',
157
- id: 'codellama:python',
158
- tokens: 16_384,
151
+ displayName: 'Command R+ 104B',
152
+ enabled: true,
153
+ id: 'command-r-plus',
154
+ tokens: 131_072,
159
155
  },
160
156
  {
161
- displayName: 'MathΣtral',
157
+ displayName: 'DeepSeek V2 16B',
162
158
  enabled: true,
163
- id: 'mathstral',
164
- tokens: 32_000, // https://huggingface.co/mistralai/mathstral-7B-v0.1
159
+ id: 'deepseek-v2',
160
+ tokens: 32_768,
165
161
  },
166
162
  {
167
- displayName: 'Mixtral 8x7B',
163
+ displayName: 'DeepSeek V2 236B',
164
+ id: 'deepseek-v2:236b',
165
+ tokens: 128_000,
166
+ },
167
+ {
168
+ displayName: 'DeepSeek Coder V2 16B',
168
169
  enabled: true,
169
- id: 'mixtral',
170
- tokens: 32_768,
170
+ id: 'deepseek-coder-v2',
171
+ tokens: 128_000,
171
172
  },
172
173
  {
173
- displayName: 'Mixtral 8x22B',
174
- id: 'mixtral:8x22b',
175
- tokens: 65_536, // https://huggingface.co/mistralai/Mixtral-8x22B-v0.1/blob/main/config.json
174
+ displayName: 'DeepSeek Coder V2 236B',
175
+ id: 'deepseek-coder-v2:236b',
176
+ tokens: 128_000,
176
177
  },
177
178
  {
178
- displayName: 'Qwen Chat 4B',
179
- id: 'qwen',
180
- tokens: 32_768,
179
+ displayName: 'Qwen2 0.5B',
180
+ id: 'qwen2:0.5b',
181
+ tokens: 128_000,
181
182
  },
182
183
  {
183
- displayName: 'Qwen Chat 7B',
184
- id: 'qwen:7b',
185
- tokens: 32_768,
184
+ displayName: 'Qwen2 1.5B',
185
+ id: 'qwen2:1.5b',
186
+ tokens: 128_000,
186
187
  },
187
188
  {
188
- displayName: 'Qwen Chat 14B',
189
- id: 'qwen:14b',
190
- tokens: 32_768,
189
+ displayName: 'Qwen2 7B',
190
+ enabled: true,
191
+ id: 'qwen2',
192
+ tokens: 128_000,
191
193
  },
192
194
  {
193
- displayName: 'Qwen Chat 72B',
194
- id: 'qwen:72b',
195
- tokens: 32_768,
195
+ displayName: 'Qwen2 72B',
196
+ id: 'qwen2:72b',
197
+ tokens: 128_000,
198
+ },
199
+ {
200
+ displayName: 'CodeQwen1.5 7B',
201
+ enabled: true,
202
+ id: 'codeqwen',
203
+ tokens: 65_536,
196
204
  },
197
205
  {
198
206
  displayName: 'LLaVA 7B',
207
+ enabled: true,
199
208
  id: 'llava',
200
- tokens: 4096, // https://huggingface.co/llava-hf/llava-1.5-7b-hf/blob/main/config.json
209
+ tokens: 4096,
201
210
  vision: true,
202
211
  },
203
212
  {
@@ -7,7 +7,7 @@ import { experimental_buildLlama2Prompt } from 'ai/prompts';
7
7
  import { LobeRuntimeAI } from '../BaseAI';
8
8
  import { AgentRuntimeErrorType } from '../error';
9
9
  import { ChatCompetitionOptions, ChatStreamPayload, ModelProvider } from '../types';
10
- import { buildAnthropicMessages } from '../utils/anthropicHelpers';
10
+ import { buildAnthropicMessages, buildAnthropicTools } from '../utils/anthropicHelpers';
11
11
  import { AgentRuntimeError } from '../utils/createError';
12
12
  import { debugStream } from '../utils/debugStream';
13
13
  import { StreamingResponse } from '../utils/response';
@@ -53,7 +53,7 @@ export class LobeBedrockAI implements LobeRuntimeAI {
53
53
  payload: ChatStreamPayload,
54
54
  options?: ChatCompetitionOptions,
55
55
  ): Promise<Response> => {
56
- const { max_tokens, messages, model, temperature, top_p } = payload;
56
+ const { max_tokens, messages, model, temperature, top_p, tools } = payload;
57
57
  const system_message = messages.find((m) => m.role === 'system');
58
58
  const user_messages = messages.filter((m) => m.role !== 'system');
59
59
 
@@ -65,6 +65,7 @@ export class LobeBedrockAI implements LobeRuntimeAI {
65
65
  messages: buildAnthropicMessages(user_messages),
66
66
  system: system_message?.content as string,
67
67
  temperature: temperature,
68
+ tools: buildAnthropicTools(tools),
68
69
  top_p: top_p,
69
70
  }),
70
71
  contentType: 'application/json',
@@ -145,13 +145,9 @@ export function LobeNextAuthDbAdapter(serverDB: NeonDatabase<typeof schema>): Ad
145
145
  },
146
146
 
147
147
  async getUser(id): Promise<AdapterUser | null> {
148
- try {
149
- const lobeUser = await UserModel.findById(id);
150
- if (!lobeUser) return null;
151
- return mapLobeUserToAdapterUser(lobeUser);
152
- } catch {
153
- return null;
154
- }
148
+ const lobeUser = await UserModel.findById(id);
149
+ if (!lobeUser) return null;
150
+ return mapLobeUserToAdapterUser(lobeUser);
155
151
  },
156
152
 
157
153
  async getUserByAccount(account): Promise<AdapterUser | null> {