@lobehub/chat 1.112.0 → 1.112.2

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/CHANGELOG.md CHANGED
@@ -2,6 +2,57 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.112.2](https://github.com/lobehub/lobe-chat/compare/v1.112.1...v1.112.2)
6
+
7
+ <sup>Released on **2025-08-16**</sup>
8
+
9
+ #### ♻ Code Refactoring
10
+
11
+ - **misc**: 重构 ArgsInput 组件.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Code refactoring
19
+
20
+ - **misc**: 重构 ArgsInput 组件,closes [#8765](https://github.com/lobehub/lobe-chat/issues/8765) ([0905559](https://github.com/lobehub/lobe-chat/commit/0905559))
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.1](https://github.com/lobehub/lobe-chat/compare/v1.112.0...v1.112.1)
31
+
32
+ <sup>Released on **2025-08-16**</sup>
33
+
34
+ #### 💄 Styles
35
+
36
+ - **misc**: Add Imagen 4 GA models, style improve auth sign in box loading.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### Styles
44
+
45
+ - **misc**: Add Imagen 4 GA models, closes [#8799](https://github.com/lobehub/lobe-chat/issues/8799) ([2e9ad20](https://github.com/lobehub/lobe-chat/commit/2e9ad20))
46
+ - **misc**: Style improve auth sign in box loading, closes [#8805](https://github.com/lobehub/lobe-chat/issues/8805) ([62f5a1b](https://github.com/lobehub/lobe-chat/commit/62f5a1b))
47
+
48
+ </details>
49
+
50
+ <div align="right">
51
+
52
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
53
+
54
+ </div>
55
+
5
56
  ## [Version 1.112.0](https://github.com/lobehub/lobe-chat/compare/v1.111.12...v1.112.0)
6
57
 
7
58
  <sup>Released on **2025-08-15**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,22 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "improvements": [
5
+ "重构 ArgsInput 组件."
6
+ ]
7
+ },
8
+ "date": "2025-08-16",
9
+ "version": "1.112.2"
10
+ },
11
+ {
12
+ "children": {
13
+ "improvements": [
14
+ "Add Imagen 4 GA models, style improve auth sign in box loading."
15
+ ]
16
+ },
17
+ "date": "2025-08-16",
18
+ "version": "1.112.1"
19
+ },
2
20
  {
3
21
  "children": {},
4
22
  "date": "2025-08-15",
@@ -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.0",
3
+ "version": "1.112.2",
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",
@@ -7,7 +7,7 @@ import { createStyles } from 'antd-style';
7
7
  import { AuthError } from 'next-auth';
8
8
  import { signIn } from 'next-auth/react';
9
9
  import { useRouter, useSearchParams } from 'next/navigation';
10
- import { memo } from 'react';
10
+ import { memo, useState } from 'react';
11
11
  import { useTranslation } from 'react-i18next';
12
12
 
13
13
  import BrandWatermark from '@/components/BrandWatermark';
@@ -70,6 +70,7 @@ export default memo(() => {
70
70
  const { styles } = useStyles();
71
71
  const { t } = useTranslation('clerk');
72
72
  const router = useRouter();
73
+ const [loadingProvider, setLoadingProvider] = useState<string | null>(null);
73
74
 
74
75
  const oAuthSSOProviders = useUserStore((s) => s.oAuthSSOProviders);
75
76
 
@@ -79,9 +80,11 @@ export default memo(() => {
79
80
  const callbackUrl = searchParams.get('callbackUrl') ?? '/';
80
81
 
81
82
  const handleSignIn = async (provider: string) => {
83
+ setLoadingProvider(provider);
82
84
  try {
83
85
  await signIn(provider, { redirectTo: callbackUrl });
84
86
  } catch (error) {
87
+ setLoadingProvider(null);
85
88
  // Signin can fail for a number of reasons, such as the user
86
89
  // not existing, or the user not having the correct role.
87
90
  // In some cases, you may want to redirect to a custom error
@@ -127,6 +130,7 @@ export default memo(() => {
127
130
  className={styles.button}
128
131
  icon={AuthIcons(provider, 16)}
129
132
  key={provider}
133
+ loading={loadingProvider === provider}
130
134
  onClick={() => handleSignIn(provider)}
131
135
  >
132
136
  {provider}
@@ -587,8 +587,46 @@ const imagenBaseParameters: ModelParamsSchema = {
587
587
  const googleImageModels: AIImageModelCard[] = [
588
588
  {
589
589
  description: 'Imagen 4th generation text-to-image model series',
590
- displayName: 'Imagen4 Preview 06-06',
590
+ displayName: 'Imagen 4',
591
591
  enabled: true,
592
+ id: 'imagen-4.0-generate-001',
593
+ organization: 'Deepmind',
594
+ parameters: imagenBaseParameters,
595
+ pricing: {
596
+ units: [{ name: 'imageGeneration', rate: 0.04, strategy: 'fixed', unit: 'image' }],
597
+ },
598
+ releasedAt: '2024-08-14',
599
+ type: 'image',
600
+ },
601
+ {
602
+ description: 'Imagen 4th generation text-to-image model series Ultra version',
603
+ displayName: 'Imagen 4 Ultra',
604
+ enabled: true,
605
+ id: 'imagen-4.0-ultra-generate-001',
606
+ organization: 'Deepmind',
607
+ parameters: imagenBaseParameters,
608
+ pricing: {
609
+ units: [{ name: 'imageGeneration', rate: 0.06, strategy: 'fixed', unit: 'image' }],
610
+ },
611
+ releasedAt: '2024-08-14',
612
+ type: 'image',
613
+ },
614
+ {
615
+ description: 'Imagen 4th generation text-to-image model series Fast version',
616
+ displayName: 'Imagen 4 Fast',
617
+ enabled: true,
618
+ id: 'imagen-4.0-fast-generate-001',
619
+ organization: 'Deepmind',
620
+ parameters: imagenBaseParameters,
621
+ pricing: {
622
+ units: [{ name: 'imageGeneration', rate: 0.02, strategy: 'fixed', unit: 'image' }],
623
+ },
624
+ releasedAt: '2024-08-14',
625
+ type: 'image',
626
+ },
627
+ {
628
+ description: 'Imagen 4th generation text-to-image model series',
629
+ displayName: 'Imagen 4 Preview 06-06',
592
630
  id: 'imagen-4.0-generate-preview-06-06',
593
631
  organization: 'Deepmind',
594
632
  parameters: imagenBaseParameters,
@@ -600,8 +638,7 @@ const googleImageModels: AIImageModelCard[] = [
600
638
  },
601
639
  {
602
640
  description: 'Imagen 4th generation text-to-image model series Ultra version',
603
- displayName: 'Imagen4 Ultra Preview 06-06',
604
- enabled: true,
641
+ displayName: 'Imagen 4 Ultra Preview 06-06',
605
642
  id: 'imagen-4.0-ultra-generate-preview-06-06',
606
643
  organization: 'Deepmind',
607
644
  parameters: imagenBaseParameters,
@@ -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: '拖拽图片和文件到这里,支持上传多个图片和文件。',