@lobehub/chat 1.112.1 → 1.112.3

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/changelog/v1.json +18 -0
  3. package/locales/en-US/components.json +5 -0
  4. package/locales/zh-CN/components.json +5 -0
  5. package/package.json +2 -2
  6. package/packages/const/package.json +6 -0
  7. package/{src/const → packages/const/src}/imageGeneration.ts +2 -4
  8. package/{src/const → packages/const/src}/url.ts +2 -3
  9. package/src/features/PluginDevModal/MCPManifestForm/ArgsInput.tsx +92 -10
  10. package/src/locales/default/components.ts +5 -0
  11. package/src/middleware.ts +1 -1
  12. package/tsconfig.json +1 -0
  13. package/vitest.config.server.ts +1 -0
  14. package/vitest.config.ts +1 -0
  15. /package/{src/const → packages/const/src}/analytics.ts +0 -0
  16. /package/{src/const → packages/const/src}/auth.ts +0 -0
  17. /package/{src/const → packages/const/src}/branding.ts +0 -0
  18. /package/{src/const → packages/const/src}/cacheControl.ts +0 -0
  19. /package/{src/const → packages/const/src}/currency.ts +0 -0
  20. /package/{src/const → packages/const/src}/desktop.ts +0 -0
  21. /package/{src/const → packages/const/src}/discover.ts +0 -0
  22. /package/{src/const → packages/const/src}/fetch.ts +0 -0
  23. /package/{src/const → packages/const/src}/file.ts +0 -0
  24. /package/{src/const → packages/const/src}/guide.ts +0 -0
  25. /package/{src/const → packages/const/src}/hotkeys.ts +0 -0
  26. /package/{src/const → packages/const/src}/image.ts +0 -0
  27. /package/{src/const → packages/const/src}/layoutTokens.test.ts +0 -0
  28. /package/{src/const → packages/const/src}/layoutTokens.ts +0 -0
  29. /package/{src/const → packages/const/src}/locale.ts +0 -0
  30. /package/{src/const → packages/const/src}/message.ts +0 -0
  31. /package/{src/const → packages/const/src}/meta.ts +0 -0
  32. /package/{src/const → packages/const/src}/models.ts +0 -0
  33. /package/{src/const → packages/const/src}/plugin.test.ts +0 -0
  34. /package/{src/const → packages/const/src}/plugin.ts +0 -0
  35. /package/{src/const → packages/const/src}/session.ts +0 -0
  36. /package/{src/const → packages/const/src}/settings/agent.ts +0 -0
  37. /package/{src/const → packages/const/src}/settings/common.ts +0 -0
  38. /package/{src/const → packages/const/src}/settings/hotkey.ts +0 -0
  39. /package/{src/const → packages/const/src}/settings/index.ts +0 -0
  40. /package/{src/const → packages/const/src}/settings/knowledge.ts +0 -0
  41. /package/{src/const → packages/const/src}/settings/llm.ts +0 -0
  42. /package/{src/const → packages/const/src}/settings/sync.ts +0 -0
  43. /package/{src/const → packages/const/src}/settings/systemAgent.ts +0 -0
  44. /package/{src/const → packages/const/src}/settings/tool.ts +0 -0
  45. /package/{src/const → packages/const/src}/settings/tts.ts +0 -0
  46. /package/{src/const → packages/const/src}/theme.ts +0 -0
  47. /package/{src/const → packages/const/src}/trace.ts +0 -0
  48. /package/{src/const → packages/const/src}/user.ts +0 -0
  49. /package/{src/const → packages/const/src}/version.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.112.3](https://github.com/lobehub/lobe-chat/compare/v1.112.2...v1.112.3)
6
+
7
+ <sup>Released on **2025-08-16**</sup>
8
+
9
+ #### ♻ Code Refactoring
10
+
11
+ - **misc**: Refactor const folder to a new package.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Code refactoring
19
+
20
+ - **misc**: Refactor const folder to a new package, closes [#8756](https://github.com/lobehub/lobe-chat/issues/8756) ([30a4734](https://github.com/lobehub/lobe-chat/commit/30a4734))
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
+
30
+ ### [Version 1.112.2](https://github.com/lobehub/lobe-chat/compare/v1.112.1...v1.112.2)
31
+
32
+ <sup>Released on **2025-08-16**</sup>
33
+
34
+ #### ♻ Code Refactoring
35
+
36
+ - **misc**: 重构 ArgsInput 组件.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### Code refactoring
44
+
45
+ - **misc**: 重构 ArgsInput 组件,closes [#8765](https://github.com/lobehub/lobe-chat/issues/8765) ([0905559](https://github.com/lobehub/lobe-chat/commit/0905559))
46
+
47
+ </details>
48
+
49
+ <div align="right">
50
+
51
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
52
+
53
+ </div>
54
+
5
55
  ### [Version 1.112.1](https://github.com/lobehub/lobe-chat/compare/v1.112.0...v1.112.1)
6
56
 
7
57
  <sup>Released on **2025-08-16**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,22 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "improvements": [
5
+ "Refactor const folder to a new package."
6
+ ]
7
+ },
8
+ "date": "2025-08-16",
9
+ "version": "1.112.3"
10
+ },
11
+ {
12
+ "children": {
13
+ "improvements": [
14
+ "重构 ArgsInput 组件."
15
+ ]
16
+ },
17
+ "date": "2025-08-16",
18
+ "version": "1.112.2"
19
+ },
2
20
  {
3
21
  "children": {
4
22
  "improvements": [
@@ -1,4 +1,9 @@
1
1
  {
2
+ "ArgsInput": {
3
+ "addArgument": "Add Argument",
4
+ "argumentPlaceholder": "Argument {{index}}",
5
+ "enterFirstArgument": "Enter first argument..."
6
+ },
2
7
  "DragUpload": {
3
8
  "dragDesc": "Drag and drop files here to upload multiple images.",
4
9
  "dragFileDesc": "Drag and drop images and files here to upload multiple images and files.",
@@ -1,4 +1,9 @@
1
1
  {
2
+ "ArgsInput": {
3
+ "addArgument": "添加参数",
4
+ "argumentPlaceholder": "参数 {{index}}",
5
+ "enterFirstArgument": "输入第一个参数..."
6
+ },
2
7
  "DragUpload": {
3
8
  "dragDesc": "拖拽文件到这里,支持上传多个图片。",
4
9
  "dragFileDesc": "拖拽图片和文件到这里,支持上传多个图片和文件。",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.112.1",
3
+ "version": "1.112.3",
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",
@@ -324,7 +324,7 @@
324
324
  "consola": "^3.4.2",
325
325
  "cross-env": "^7.0.3",
326
326
  "crypto-js": "^4.2.0",
327
- "dbdocs": "^0.14.4",
327
+ "dbdocs": "^0.16.0",
328
328
  "dotenv": "^16.6.1",
329
329
  "dpdm-fast": "1.0.7",
330
330
  "drizzle-dbml-generator": "^0.10.0",
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "@lobechat/const",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "main": "./src/index.ts"
6
+ }
@@ -2,17 +2,15 @@
2
2
  * Image generation and processing configuration constants
3
3
  */
4
4
  export const IMAGE_GENERATION_CONFIG = {
5
-
6
5
  /**
7
6
  * Maximum cover image size in pixels (longest edge)
8
7
  * Used for generating cover images from source images
9
8
  */
10
- COVER_MAX_SIZE: 256,
9
+ COVER_MAX_SIZE: 256,
11
10
 
12
-
13
11
  /**
14
12
  * Maximum thumbnail size in pixels (longest edge)
15
13
  * Used for generating thumbnail images from original images
16
14
  */
17
- THUMBNAIL_MAX_SIZE: 512,
15
+ THUMBNAIL_MAX_SIZE: 512,
18
16
  } as const;
@@ -4,7 +4,6 @@ import urlJoin from 'url-join';
4
4
  import { withBasePath } from '@/utils/basePath';
5
5
  import { isDev } from '@/utils/env';
6
6
 
7
- import pkg from '../../package.json';
8
7
  import { INBOX_SESSION_ID } from './session';
9
8
 
10
9
  export const UTM_SOURCE = 'chat_preview';
@@ -15,7 +14,7 @@ export const OFFICIAL_SITE = 'https://lobehub.com';
15
14
 
16
15
  export const OG_URL = '/og/cover.png?v=1';
17
16
 
18
- export const GITHUB = pkg.homepage;
17
+ export const GITHUB = 'https://github.com/lobehub/lobe-chat';
19
18
  export const GITHUB_ISSUES = urlJoin(GITHUB, 'issues/new/choose');
20
19
  export const CHANGELOG = 'https://lobehub.com/changelog';
21
20
  export const DOCKER_IMAGE = 'https://hub.docker.com/r/lobehub/lobe-chat';
@@ -36,7 +35,7 @@ export const MANUAL_UPGRADE_URL = urlJoin(SELF_HOSTING_DOCUMENTS, '/advanced/ups
36
35
  export const BLOG = urlJoin(OFFICIAL_SITE, 'blog');
37
36
 
38
37
  export const ABOUT = OFFICIAL_SITE;
39
- export const FEEDBACK = pkg.bugs.url;
38
+ export const FEEDBACK = 'https://github.com/lobehub/lobe-chat/issues/new/choose';
40
39
  export const PRIVACY_URL = urlJoin(OFFICIAL_SITE, '/privacy');
41
40
  export const TERMS_URL = urlJoin(OFFICIAL_SITE, '/terms');
42
41
 
@@ -1,20 +1,102 @@
1
- import { Input, type InputProps } from '@lobehub/ui';
2
- import { memo } from 'react';
1
+ import { ActionIcon, Button, Input, type InputProps } from '@lobehub/ui';
2
+ import { Plus, X } from 'lucide-react';
3
+ import React, { memo, useCallback } from 'react';
4
+ import { useTranslation } from 'react-i18next';
5
+ import { Flexbox } from 'react-layout-kit';
3
6
 
4
7
  interface ArgsInputProps extends Omit<InputProps, 'value' | 'onChange'> {
5
8
  onChange?: (value: string[]) => void;
6
9
  value?: string[];
7
10
  }
8
11
 
9
- const ArgsInput = memo<ArgsInputProps>(({ value, onChange, ...res }) => {
12
+ const ArgsInput = memo<ArgsInputProps>(({ value = [], onChange, ...res }) => {
13
+ const { t } = useTranslation('components');
14
+
15
+ const handleAddArg = useCallback(() => {
16
+ onChange?.([...value, '']);
17
+ }, [value, onChange]);
18
+
19
+ const handleRemoveArg = useCallback(
20
+ (index: number) => {
21
+ const newValue = value.filter((_, i) => i !== index);
22
+ onChange?.(newValue);
23
+ },
24
+ [value, onChange],
25
+ );
26
+
27
+ const handleArgChange = useCallback(
28
+ (index: number, newArg: string) => {
29
+ const newValue = [...value];
30
+ newValue[index] = newArg;
31
+ onChange?.(newValue);
32
+ },
33
+ [value, onChange],
34
+ );
35
+
36
+ const handleKeyDown = useCallback(
37
+ (e: React.KeyboardEvent<HTMLInputElement>, index: number) => {
38
+ if (e.key === 'Enter') {
39
+ e.preventDefault();
40
+ if (index === value.length - 1) {
41
+ handleAddArg();
42
+ }
43
+ } else if (e.key === 'Backspace' && e.currentTarget.value === '' && value.length > 1) {
44
+ e.preventDefault();
45
+ handleRemoveArg(index);
46
+ }
47
+ },
48
+ [value.length, handleAddArg, handleRemoveArg],
49
+ );
50
+
10
51
  return (
11
- <Input
12
- onChange={(e) => {
13
- onChange?.([e.target.value]);
14
- }}
15
- value={value?.join(' ')}
16
- {...res}
17
- />
52
+ <Flexbox gap={8} style={{ width: '100%' }}>
53
+ {value.length === 0 ? (
54
+ <Flexbox align="center" gap={8} horizontal>
55
+ <Input
56
+ {...res}
57
+ onBlur={(e) => {
58
+ if (e.target.value.trim()) {
59
+ onChange?.([e.target.value.trim()]);
60
+ }
61
+ res.onBlur?.(e);
62
+ }}
63
+ placeholder={t('ArgsInput.enterFirstArgument')}
64
+ style={{ flex: 1 }}
65
+ />
66
+ <Button icon={Plus} onClick={handleAddArg} size="small" type="primary" />
67
+ </Flexbox>
68
+ ) : (
69
+ <>
70
+ {value.map((arg, index) => (
71
+ <Flexbox align="center" gap={8} horizontal key={index}>
72
+ <Input
73
+ onChange={(e) => handleArgChange(index, e.target.value)}
74
+ onKeyDown={(e) => handleKeyDown(e, index)}
75
+ placeholder={t('ArgsInput.argumentPlaceholder', { index: index + 1 })}
76
+ style={{ flex: 1 }}
77
+ value={arg}
78
+ />
79
+ <ActionIcon
80
+ icon={X}
81
+ onClick={() => handleRemoveArg(index)}
82
+ size="small"
83
+ style={{ flexShrink: 0 }}
84
+ />
85
+ </Flexbox>
86
+ ))}
87
+ <Button
88
+ icon={Plus}
89
+ onClick={handleAddArg}
90
+ size="small"
91
+ style={{ alignSelf: 'flex-start' }}
92
+ type="dashed"
93
+ >
94
+ {t('ArgsInput.addArgument')}
95
+ </Button>
96
+ </>
97
+ )}
98
+ </Flexbox>
18
99
  );
19
100
  });
101
+
20
102
  export default ArgsInput;
@@ -1,4 +1,9 @@
1
1
  export default {
2
+ ArgsInput: {
3
+ addArgument: '添加参数',
4
+ argumentPlaceholder: '参数 {{index}}',
5
+ enterFirstArgument: '输入第一个参数...',
6
+ },
2
7
  DragUpload: {
3
8
  dragDesc: '拖拽文件到这里,支持上传多个图片。',
4
9
  dragFileDesc: '拖拽图片和文件到这里,支持上传多个图片和文件。',
package/src/middleware.ts CHANGED
@@ -5,6 +5,7 @@ import { UAParser } from 'ua-parser-js';
5
5
  import urlJoin from 'url-join';
6
6
 
7
7
  import { authEnv } from '@/config/auth';
8
+ import { OAUTH_AUTHORIZED } from '@/const/auth';
8
9
  import { LOBE_LOCALE_COOKIE } from '@/const/locale';
9
10
  import { LOBE_THEME_APPEARANCE } from '@/const/theme';
10
11
  import { appEnv } from '@/envs/app';
@@ -14,7 +15,6 @@ import { parseBrowserLanguage } from '@/utils/locale';
14
15
  import { parseDefaultThemeFromCountry } from '@/utils/server/geo';
15
16
  import { RouteVariants } from '@/utils/server/routeVariants';
16
17
 
17
- import { OAUTH_AUTHORIZED } from './const/auth';
18
18
  import { oidcEnv } from './envs/oidc';
19
19
 
20
20
  // Create debug logger instances
package/tsconfig.json CHANGED
@@ -20,6 +20,7 @@
20
20
  "paths": {
21
21
  "@/libs/model-runtime": ["./packages/model-runtime/src/index.ts"],
22
22
  "@/libs/model-runtime/*": ["./packages/model-runtime/src/*"],
23
+ "@/const/*": ["./packages/const/src/*"],
23
24
  "@/types/*": ["./packages/types/src/*", "./src/types/*"],
24
25
  "@/*": ["./src/*"],
25
26
  "~test-utils": ["./tests/utils.tsx"]
@@ -5,6 +5,7 @@ export default defineConfig({
5
5
  test: {
6
6
  alias: {
7
7
  /* eslint-disable sort-keys-fix/sort-keys-fix */
8
+ '@/const': resolve(__dirname, './packages/const/src'),
8
9
  '@/types': resolve(__dirname, './packages/types/src'),
9
10
  '@': resolve(__dirname, './src'),
10
11
  /* eslint-enable */
package/vitest.config.ts CHANGED
@@ -11,6 +11,7 @@ export default defineConfig({
11
11
  /* eslint-disable sort-keys-fix/sort-keys-fix */
12
12
  '@/libs/model-runtime': resolve(__dirname, './packages/model-runtime/src'),
13
13
  '@/types': resolve(__dirname, './packages/types/src'),
14
+ '@/const': resolve(__dirname, './packages/const/src'),
14
15
  '@': resolve(__dirname, './src'),
15
16
  '~test-utils': resolve(__dirname, './tests/utils.tsx'),
16
17
  /* eslint-enable */
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes