瀏覽代碼

Feat: Run eslint when the project is running to standardize everyone's code #9377 (#9379)

### What problem does this PR solve?

Feat: Run eslint when the project is running to standardize everyone's
code #9377

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
tags/v0.20.2
balibabu 2 月之前
父節點
當前提交
a060672b31
No account linked to committer's email address
共有 62 個文件被更改,包括 330 次插入179 次删除
  1. 39
    1
      web/.eslintrc.js
  2. 10
    0
      web/.umirc.ts
  3. 170
    9
      web/package-lock.json
  4. 2
    0
      web/package.json
  5. 0
    0
      web/src/assets/icon/next-icon.tsx
  6. 0
    1
      web/src/components/chunk-method-dialog/index.tsx
  7. 3
    5
      web/src/components/editable-cell.tsx
  8. 1
    1
      web/src/components/highlight-markdown/index.tsx
  9. 1
    1
      web/src/components/message-item/group-button.tsx
  10. 8
    3
      web/src/components/next-markdown-content/index.tsx
  11. 1
    1
      web/src/components/next-message-item/group-button.tsx
  12. 1
    1
      web/src/components/next-message-item/index.tsx
  13. 1
    1
      web/src/components/originui/timeline.tsx
  14. 2
    8
      web/src/components/password-input/index.tsx
  15. 1
    1
      web/src/components/ui/command.tsx
  16. 1
    1
      web/src/components/ui/multi-select.tsx
  17. 6
    9
      web/src/components/ui/sidebar.tsx
  18. 1
    1
      web/src/hooks/logic-hooks.ts
  19. 1
    10
      web/src/hooks/use-agent-request.ts
  20. 1
    1
      web/src/hooks/use-chat-request.ts
  21. 8
    9
      web/src/layouts/next-header.tsx
  22. 1
    1
      web/src/pages/add-knowledge/components/knowledge-file/hooks.ts
  23. 1
    1
      web/src/pages/add-knowledge/components/knowledge-file/index.tsx
  24. 0
    9
      web/src/pages/add-knowledge/components/knowledge-sidebar/index.tsx
  25. 1
    12
      web/src/pages/agent/canvas/node/retrieval-node.tsx
  26. 1
    5
      web/src/pages/agent/form/categorize-form/use-values.ts
  27. 1
    1
      web/src/pages/agent/form/components/next-dynamic-input-variable.tsx
  28. 0
    12
      web/src/pages/agent/form/relevant-form/hooks.ts
  29. 1
    1
      web/src/pages/agent/log-sheet/index.tsx
  30. 1
    1
      web/src/pages/agent/log-sheet/tool-timeline-item.tsx
  31. 1
    1
      web/src/pages/agent/log-sheet/workflow-timeline.tsx
  32. 3
    5
      web/src/pages/chat/chat-configuration-modal/editable-cell.tsx
  33. 8
    3
      web/src/pages/chat/markdown-content/index.tsx
  34. 1
    1
      web/src/pages/chat/shared-hooks.ts
  35. 0
    6
      web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/components/chunk-creating-modal/index.tsx
  36. 1
    1
      web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/components/document-preview/csv-preview.tsx
  37. 2
    14
      web/src/pages/dataset/testing/index.tsx
  38. 1
    1
      web/src/pages/flow/constant.tsx
  39. 1
    1
      web/src/pages/flow/form/iteration-from/index.tsx
  40. 9
    10
      web/src/pages/flow/form/relevant-form/hooks.ts
  41. 11
    7
      web/src/pages/flow/hooks/use-save-graph.ts
  42. 1
    0
      web/src/pages/login-next/hooks.ts
  43. 1
    1
      web/src/pages/next-chats/hooks/use-send-shared-message.ts
  44. 1
    2
      web/src/pages/next-search/search-setting.tsx
  45. 1
    1
      web/src/pages/next-searches/index.tsx
  46. 9
    2
      web/src/pages/search/hooks.ts
  47. 1
    1
      web/src/pages/user-setting/constants.tsx
  48. 1
    1
      web/src/pages/user-setting/setting-locale/index.tsx
  49. 0
    0
      web/src/pages/user-setting/setting-locale/translation-table.tsx
  50. 2
    2
      web/src/pages/user-setting/setting-model/azure-openai-modal/index.tsx
  51. 1
    1
      web/src/pages/user-setting/setting-model/bedrock-modal/index.tsx
  52. 1
    1
      web/src/pages/user-setting/setting-model/fish-audio-modal/index.tsx
  53. 1
    1
      web/src/pages/user-setting/setting-model/google-modal/index.tsx
  54. 0
    1
      web/src/pages/user-setting/setting-model/hooks.ts
  55. 1
    3
      web/src/pages/user-setting/setting-model/hunyuan-modal/index.tsx
  56. 1
    1
      web/src/pages/user-setting/setting-model/index.tsx
  57. 0
    0
      web/src/pages/user-setting/setting-model/next-tencent-modal/index.tsx
  58. 1
    1
      web/src/pages/user-setting/setting-model/spark-modal/index.tsx
  59. 1
    1
      web/src/pages/user-setting/setting-model/volcengine-modal/index.tsx
  60. 1
    1
      web/src/pages/user-setting/setting-model/yiyan-modal/index.tsx
  61. 1
    1
      web/src/services/next-chat-service.ts
  62. 1
    0
      web/src/utils/register-server.ts

+ 39
- 1
web/.eslintrc.js 查看文件

@@ -1,5 +1,43 @@
// .eslintrc.js
module.exports = {
// Umi 项目
extends: [require.resolve('umi/eslint'), 'plugin:react-hooks/recommended'],
plugins: ['check-file'],
rules: {
'@typescript-eslint/no-use-before-define': [
'warn',
{
functions: false,
variables: true,
},
],
'check-file/filename-naming-convention': [
'error',
{
'**/*.{jsx,tsx}': 'KEBAB_CASE',
'**/*.{js,ts}': 'KEBAB_CASE',
},
],
'check-file/folder-naming-convention': [
'error',
{
'src/**/': 'KEBAB_CASE',
'mocks/*/': 'KEBAB_CASE',
},
],
'react/no-unescaped-entities': [
'warn',
{
forbid: [
{
char: "'",
alternatives: [''', '''],
},
{
char: '"',
alternatives: ['"', '"'],
},
],
},
],
},
};

+ 10
- 0
web/.umirc.ts 查看文件

@@ -3,6 +3,7 @@ import TerserPlugin from 'terser-webpack-plugin';
import { defineConfig } from 'umi';
import { appName } from './src/conf.json';
import routes from './src/routes';
const ESLintPlugin = require('eslint-webpack-plugin');

export default defineConfig({
title: appName,
@@ -52,6 +53,15 @@ export default defineConfig({

memo.optimization.minimizer('terser').use(TerserPlugin); // Fixed the issue that the page displayed an error after packaging lexical with terser

memo.plugin('eslint').use(ESLintPlugin, [
{
extensions: ['js', 'ts', 'tsx'],
failOnError: true,
exclude: ['**/node_modules/**', '**/mfsu**', '**/mfsu-virtual-entry**'],
files: ['src/**/*.{js,ts,tsx}'],
},
]);

return memo;
},
tailwindcss: {},

+ 170
- 9
web/package-lock.json 查看文件

@@ -121,6 +121,8 @@
"@umijs/plugins": "^4.1.0",
"@welldone-software/why-did-you-render": "^8.0.3",
"cross-env": "^7.0.3",
"eslint-plugin-check-file": "^2.8.0",
"eslint-webpack-plugin": "^4.1.0",
"html-loader": "^5.1.0",
"husky": "^9.0.11",
"jest": "^29.7.0",
@@ -9147,9 +9149,10 @@
}
},
"node_modules/@types/eslint": {
"version": "8.56.1",
"resolved": "https://registry.npmmirror.com/@types/eslint/-/eslint-8.56.1.tgz",
"integrity": "sha512-18PLWRzhy9glDQp3+wOgfLYRWlhgX0azxgJ63rdpoUHyrC9z0f5CkFburjQx4uD7ZCruw85ZtMt6K+L+R8fLJQ==",
"version": "9.6.1",
"resolved": "https://registry.npmmirror.com/@types/eslint/-/eslint-9.6.1.tgz",
"integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==",
"license": "MIT",
"peer": true,
"dependencies": {
"@types/estree": "*",
@@ -16334,6 +16337,27 @@
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
},
"node_modules/eslint-plugin-check-file": {
"version": "2.8.0",
"resolved": "https://registry.npmmirror.com/eslint-plugin-check-file/-/eslint-plugin-check-file-2.8.0.tgz",
"integrity": "sha512-FvvafMTam2WJYH9uj+FuMxQ1y+7jY3Z6P9T4j2214cH0FBxNzTcmeCiGTj1Lxp3mI6kbbgsXvmgewvf+llKYyw==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"is-glob": "^4.0.3",
"micromatch": "^4.0.5"
},
"engines": {
"node": ">=18"
},
"funding": {
"type": "ko_fi",
"url": "https://ko-fi.com/huanluo"
},
"peerDependencies": {
"eslint": ">=7.28.0"
}
},
"node_modules/eslint-plugin-jest": {
"version": "27.2.3",
"resolved": "https://registry.npmmirror.com/eslint-plugin-jest/-/eslint-plugin-jest-27.2.3.tgz",
@@ -16437,6 +16461,141 @@
"node": ">=10"
}
},
"node_modules/eslint-webpack-plugin": {
"version": "4.1.0",
"resolved": "https://registry.npmmirror.com/eslint-webpack-plugin/-/eslint-webpack-plugin-4.1.0.tgz",
"integrity": "sha512-C3wAG2jyockIhN0YRLuKieKj2nx/gnE/VHmoHemD5ifnAtY6ZU+jNPfzPoX4Zd6RIbUyWTiZUh/ofUlBhoAX7w==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/eslint": "^8.56.5",
"jest-worker": "^29.7.0",
"micromatch": "^4.0.5",
"normalize-path": "^3.0.0",
"schema-utils": "^4.2.0"
},
"engines": {
"node": ">= 14.15.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/webpack"
},
"peerDependencies": {
"eslint": "^8.0.0",
"webpack": "^5.0.0"
}
},
"node_modules/eslint-webpack-plugin/node_modules/@types/eslint": {
"version": "8.56.12",
"resolved": "https://registry.npmmirror.com/@types/eslint/-/eslint-8.56.12.tgz",
"integrity": "sha512-03ruubjWyOHlmljCVoxSuNDdmfZDzsrrz0P2LeJsOXr+ZwFQ+0yQIwNCwt/GYhV7Z31fgtXJTAEs+FYlEL851g==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/estree": "*",
"@types/json-schema": "*"
}
},
"node_modules/eslint-webpack-plugin/node_modules/ajv": {
"version": "8.17.1",
"resolved": "https://registry.npmmirror.com/ajv/-/ajv-8.17.1.tgz",
"integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==",
"dev": true,
"license": "MIT",
"dependencies": {
"fast-deep-equal": "^3.1.3",
"fast-uri": "^3.0.1",
"json-schema-traverse": "^1.0.0",
"require-from-string": "^2.0.2"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/epoberezkin"
}
},
"node_modules/eslint-webpack-plugin/node_modules/ajv-keywords": {
"version": "5.1.0",
"resolved": "https://registry.npmmirror.com/ajv-keywords/-/ajv-keywords-5.1.0.tgz",
"integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==",
"dev": true,
"license": "MIT",
"dependencies": {
"fast-deep-equal": "^3.1.3"
},
"peerDependencies": {
"ajv": "^8.8.2"
}
},
"node_modules/eslint-webpack-plugin/node_modules/has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmmirror.com/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/eslint-webpack-plugin/node_modules/jest-worker": {
"version": "29.7.0",
"resolved": "https://registry.npmmirror.com/jest-worker/-/jest-worker-29.7.0.tgz",
"integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/node": "*",
"jest-util": "^29.7.0",
"merge-stream": "^2.0.0",
"supports-color": "^8.0.0"
},
"engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
}
},
"node_modules/eslint-webpack-plugin/node_modules/json-schema-traverse": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
"dev": true,
"license": "MIT"
},
"node_modules/eslint-webpack-plugin/node_modules/schema-utils": {
"version": "4.3.2",
"resolved": "https://registry.npmmirror.com/schema-utils/-/schema-utils-4.3.2.tgz",
"integrity": "sha512-Gn/JaSk/Mt9gYubxTtSn/QCV4em9mpAPiR1rqy/Ocu19u/G9J5WWdNoUT4SiV6mFC3y6cxyFcFwdzPM3FgxGAQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/json-schema": "^7.0.9",
"ajv": "^8.9.0",
"ajv-formats": "^2.1.1",
"ajv-keywords": "^5.1.0"
},
"engines": {
"node": ">= 10.13.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/webpack"
}
},
"node_modules/eslint-webpack-plugin/node_modules/supports-color": {
"version": "8.1.1",
"resolved": "https://registry.npmmirror.com/supports-color/-/supports-color-8.1.1.tgz",
"integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"has-flag": "^4.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/supports-color?sponsor=1"
}
},
"node_modules/eslint/node_modules/ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-4.3.0.tgz",
@@ -17222,9 +17381,10 @@
}
},
"node_modules/flatted": {
"version": "3.2.9",
"resolved": "https://registry.npmmirror.com/flatted/-/flatted-3.2.9.tgz",
"integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==",
"version": "3.3.3",
"resolved": "https://registry.npmmirror.com/flatted/-/flatted-3.3.3.tgz",
"integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==",
"license": "ISC",
"peer": true
},
"node_modules/flatten": {
@@ -24121,9 +24281,10 @@
"integrity": "sha512-oNh6S2WMHWRZrmutsRmDDfkzKtxF+bc2VxLC9dvtrDIRFln627VsFP6fLMgTryGDljgLPjkrzQSDcPrjPyDJ5w=="
},
"node_modules/micromatch": {
"version": "4.0.7",
"resolved": "https://registry.npmmirror.com/micromatch/-/micromatch-4.0.7.tgz",
"integrity": "sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==",
"version": "4.0.8",
"resolved": "https://registry.npmmirror.com/micromatch/-/micromatch-4.0.8.tgz",
"integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
"license": "MIT",
"dependencies": {
"braces": "^3.0.3",
"picomatch": "^2.3.1"

+ 2
- 0
web/package.json 查看文件

@@ -132,6 +132,8 @@
"@umijs/plugins": "^4.1.0",
"@welldone-software/why-did-you-render": "^8.0.3",
"cross-env": "^7.0.3",
"eslint-plugin-check-file": "^2.8.0",
"eslint-webpack-plugin": "^4.1.0",
"html-loader": "^5.1.0",
"husky": "^9.0.11",
"jest": "^29.7.0",

web/src/assets/icon/Icon.tsx → web/src/assets/icon/next-icon.tsx 查看文件


+ 0
- 1
web/src/components/chunk-method-dialog/index.tsx 查看文件

@@ -80,7 +80,6 @@ export function ChunkMethodDialog({
hideModal,
onOk,
parserId,
documentId,
documentExtension,
visible,
parserConfig,

+ 3
- 5
web/src/components/editable-cell.tsx 查看文件

@@ -1,4 +1,5 @@
import { Form, FormInstance, Input, InputRef, Typography } from 'antd';
import { omit } from 'lodash';
import React, { useContext, useEffect, useRef, useState } from 'react';

const EditableContext = React.createContext<FormInstance<any> | null>(null);
@@ -15,15 +16,12 @@ interface Item {
address: string;
}

export const EditableRow: React.FC<EditableRowProps> = ({
index,
...props
}) => {
export const EditableRow: React.FC<EditableRowProps> = ({ ...props }) => {
const [form] = Form.useForm();
return (
<Form form={form} component={false}>
<EditableContext.Provider value={form}>
<tr {...props} />
<tr {...omit(props, 'index')} />
</EditableContext.Provider>
</Form>
);

+ 1
- 1
web/src/components/highlight-markdown/index.tsx 查看文件

@@ -31,7 +31,7 @@ const HightLightMarkdown = ({
components={
{
code(props: any) {
const { children, className, node, ...rest } = props;
const { children, className, ...rest } = props;
const match = /language-(\w+)/.exec(className || '');
return match ? (
<SyntaxHighlighter

+ 1
- 1
web/src/components/message-item/group-button.tsx 查看文件

@@ -1,4 +1,4 @@
import { PromptIcon } from '@/assets/icon/Icon';
import { PromptIcon } from '@/assets/icon/next-icon';
import CopyToClipboard from '@/components/copy-to-clipboard';
import { useSetModalState } from '@/hooks/common-hooks';
import { IRemoveMessageById } from '@/hooks/logic-hooks';

+ 8
- 3
web/src/components/next-markdown-content/index.tsx 查看文件

@@ -27,6 +27,7 @@ import {
import { cn } from '@/lib/utils';
import { currentReg, replaceTextByOldReg } from '@/pages/chat/utils';
import classNames from 'classnames';
import { omit } from 'lodash';
import { pipe } from 'lodash/fp';
import { CircleAlert } from 'lucide-react';
import { Button } from '../ui/button';
@@ -256,11 +257,12 @@ function MarkdownContent({
'custom-typography': ({ children }: { children: string }) =>
renderReference(children),
code(props: any) {
const { children, className, node, ...rest } = props;
const { children, className, ...rest } = props;
const restProps = omit(rest, 'node');
const match = /language-(\w+)/.exec(className || '');
return match ? (
<SyntaxHighlighter
{...rest}
{...restProps}
PreTag="div"
language={match[1]}
wrapLongLines
@@ -268,7 +270,10 @@ function MarkdownContent({
{String(children).replace(/\n$/, '')}
</SyntaxHighlighter>
) : (
<code {...rest} className={classNames(className, 'text-wrap')}>
<code
{...restProps}
className={classNames(className, 'text-wrap')}
>
{children}
</code>
);

+ 1
- 1
web/src/components/next-message-item/group-button.tsx 查看文件

@@ -1,4 +1,4 @@
import { PromptIcon } from '@/assets/icon/Icon';
import { PromptIcon } from '@/assets/icon/next-icon';
import CopyToClipboard from '@/components/copy-to-clipboard';
import { useSetModalState } from '@/hooks/common-hooks';
import { IRemoveMessageById } from '@/hooks/logic-hooks';

+ 1
- 1
web/src/components/next-message-item/index.tsx 查看文件

@@ -17,7 +17,7 @@ import { IRegenerateMessage, IRemoveMessageById } from '@/hooks/logic-hooks';
import { INodeEvent, MessageEventType } from '@/hooks/use-send-message';
import { cn } from '@/lib/utils';
import { AgentChatContext } from '@/pages/agent/context';
import { WorkFlowTimeline } from '@/pages/agent/log-sheet/workFlowTimeline';
import { WorkFlowTimeline } from '@/pages/agent/log-sheet/workflow-timeline';
import { IMessage } from '@/pages/chat/interface';
import { isEmpty } from 'lodash';
import { Atom, ChevronDown, ChevronUp } from 'lucide-react';

+ 1
- 1
web/src/components/originui/timeline.tsx 查看文件

@@ -124,7 +124,7 @@ interface TimelineIndicatorProps extends React.HTMLAttributes<HTMLDivElement> {
}

function TimelineIndicator({
asChild = false,
// asChild = false,
className,
children,
...props

+ 2
- 8
web/src/components/password-input/index.tsx 查看文件

@@ -1,7 +1,6 @@
import { Input } from '@/components/originui/input';
import { useTranslate } from '@/hooks/common-hooks';
import { EyeIcon, EyeOffIcon } from 'lucide-react';
import { ChangeEvent, LegacyRef, forwardRef, useId, useState } from 'react';
import { ChangeEvent, forwardRef, useId, useState } from 'react';

type PropType = {
name: string;
@@ -10,17 +9,12 @@ type PropType = {
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
};

function PasswordInput(
props: PropType,
ref: LegacyRef<HTMLInputElement> | undefined,
) {
function PasswordInput(props: PropType) {
const id = useId();
const [isVisible, setIsVisible] = useState<boolean>(false);

const toggleVisibility = () => setIsVisible((prevState) => !prevState);

const { t } = useTranslate('setting');

return (
<div className="*:not-first:mt-2 w-full">
{/* <Label htmlFor={id}>Show/hide password input</Label> */}

+ 1
- 1
web/src/components/ui/command.tsx 查看文件

@@ -39,7 +39,7 @@ const CommandInput = React.forwardRef<
React.ElementRef<typeof CommandPrimitive.Input>,
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
>(({ className, ...props }, ref) => (
<div className="flex items-center border-b px-3" cmdk-input-wrapper="">
<div className="flex items-center border-b px-3" data-cmdk-input-wrapper="">
<Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
<CommandPrimitive.Input
ref={ref}

+ 1
- 1
web/src/components/ui/multi-select.tsx 查看文件

@@ -196,7 +196,7 @@ export const MultiSelect = React.forwardRef<
animation = 0,
maxCount = 3,
modalPopover = false,
asChild = false,
// asChild = false,
className,
showSelectAll = true,
...props

+ 6
- 9
web/src/components/ui/sidebar.tsx 查看文件

@@ -26,7 +26,7 @@ const SIDEBAR_WIDTH_MOBILE = '18rem';
const SIDEBAR_WIDTH_ICON = '3rem';
const SIDEBAR_KEYBOARD_SHORTCUT = 'b';

type SidebarContext = {
type SidebarContextType = {
state: 'expanded' | 'collapsed';
open: boolean;
setOpen: (open: boolean) => void;
@@ -36,7 +36,7 @@ type SidebarContext = {
toggleSidebar: () => void;
};

const SidebarContext = React.createContext<SidebarContext | null>(null);
const SidebarContext = React.createContext<SidebarContextType | null>(null);

function useSidebar() {
const context = React.useContext(SidebarContext);
@@ -116,7 +116,7 @@ const SidebarProvider = React.forwardRef<
// This makes it easier to style the sidebar with Tailwind classes.
const state = open ? 'expanded' : 'collapsed';

const contextValue = React.useMemo<SidebarContext>(
const contextValue = React.useMemo<SidebarContextType>(
() => ({
state,
open,
@@ -580,11 +580,8 @@ const SidebarMenuButton = React.forwardRef<
return button;
}

if (typeof tooltip === 'string') {
tooltip = {
children: tooltip,
};
}
const tooltipContent =
typeof tooltip === 'string' ? { children: tooltip } : tooltip;

return (
<Tooltip>
@@ -593,7 +590,7 @@ const SidebarMenuButton = React.forwardRef<
side="right"
align="center"
hidden={state !== 'collapsed' || isMobile}
{...tooltip}
{...tooltipContent}
/>
</Tooltip>
);

+ 1
- 1
web/src/hooks/logic-hooks.ts 查看文件

@@ -27,7 +27,7 @@ import { useTranslate } from './common-hooks';
import { useSetPaginationParams } from './route-hook';
import { useFetchTenantInfo, useSaveSetting } from './user-setting-hooks';

function usePrevious<T>(value: T) {
export function usePrevious<T>(value: T) {
const ref = useRef<T>();
useEffect(() => {
ref.current = value;

+ 1
- 10
web/src/hooks/use-agent-request.ts 查看文件

@@ -368,16 +368,7 @@ export const useUploadCanvasFileWithProgress = (
{
url: api.uploadAgentFile(identifier || id),
data: formData,
onUploadProgress: ({
loaded,
total,
progress,
bytes,
estimated,
rate,
upload,
lengthComputable,
}) => {
onUploadProgress: ({ progress }) => {
files.forEach((file) => {
onProgress(file, (progress || 0) * 100);
});

+ 1
- 1
web/src/hooks/use-chat-request.ts 查看文件

@@ -5,7 +5,7 @@ import { IAskRequestBody } from '@/interfaces/request/chat';
import { IClientConversation } from '@/pages/next-chats/chat/interface';
import { useGetSharedChatSearchParams } from '@/pages/next-chats/hooks/use-send-shared-message';
import { isConversationIdExist } from '@/pages/next-chats/utils';
import chatService from '@/services/next-chat-service ';
import chatService from '@/services/next-chat-service';
import { buildMessageListWithUuid, getConversationId } from '@/utils/chat';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { useDebounce } from 'ahooks';

+ 8
- 9
web/src/layouts/next-header.tsx 查看文件

@@ -13,8 +13,7 @@ import { LanguageList, LanguageMap, ThemeEnum } from '@/constants/common';
import { useChangeLanguage } from '@/hooks/logic-hooks';
import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks';
import { useNavigateWithFromState } from '@/hooks/route-hook';
import { useFetchUserInfo, useListTenant } from '@/hooks/user-setting-hooks';
import { TenantRole } from '@/pages/user-setting/constants';
import { useFetchUserInfo } from '@/hooks/user-setting-hooks';
import { Routes } from '@/routes';
import { camelCase } from 'lodash';
import {
@@ -55,11 +54,11 @@ export function Header() {
changeLanguage(key);
};

const { data } = useListTenant();
// const { data } = useListTenant();

const showBell = useMemo(() => {
return data.some((x) => x.role === TenantRole.Invite);
}, [data]);
// const showBell = useMemo(() => {
// return data.some((x) => x.role === TenantRole.Invite);
// }, [data]);

const items = LanguageList.map((x) => ({
key: x,
@@ -70,9 +69,9 @@ export function Header() {
setTheme(theme === ThemeEnum.Dark ? ThemeEnum.Light : ThemeEnum.Dark);
}, [setTheme, theme]);

const handleBellClick = useCallback(() => {
navigate('/user-setting/team');
}, [navigate]);
// const handleBellClick = useCallback(() => {
// navigate('/user-setting/team');
// }, [navigate]);

const tagsData = useMemo(
() => [

+ 1
- 1
web/src/pages/add-knowledge/components/knowledge-file/hooks.ts 查看文件

@@ -147,7 +147,7 @@ export const useHandleUploadDocument = () => {
const [fileList, setFileList] = useState<UploadFile[]>([]);
const [uploadProgress, setUploadProgress] = useState<number>(0);
const { uploadDocument, loading } = useUploadNextDocument();
const { runDocumentByIds, loading: _ } = useRunNextDocument();
const { runDocumentByIds } = useRunNextDocument();

const onDocumentUploadOk = useCallback(
async ({

+ 1
- 1
web/src/pages/add-knowledge/components/knowledge-file/index.tsx 查看文件

@@ -168,7 +168,7 @@ const KnowledgeFile = () => {
),
dataIndex: 'run',
key: 'run',
filters: Object.entries(RunningStatus).map(([key, value]) => ({
filters: Object.values(RunningStatus).map((value) => ({
text: t(`runningStatus${value}`),
value: value,
})),

+ 0
- 9
web/src/pages/add-knowledge/components/knowledge-sidebar/index.tsx 查看文件

@@ -27,7 +27,6 @@ const KnowledgeSidebar = () => {
const { knowledgeId } = useGetKnowledgeSearchParams();

const [windowWidth, setWindowWidth] = useState(getWidth());
const [collapsed, setCollapsed] = useState(false);
const { t } = useTranslation();
const { data: knowledgeDetails } = useFetchKnowledgeBaseConfiguration();

@@ -92,14 +91,6 @@ const KnowledgeSidebar = () => {
return list;
}, [data, getItem]);

useEffect(() => {
if (windowWidth.width > 957) {
setCollapsed(false);
} else {
setCollapsed(true);
}
}, [windowWidth.width]);

useEffect(() => {
const widthSize = () => {
const width = getWidth();

+ 1
- 12
web/src/pages/agent/canvas/node/retrieval-node.tsx 查看文件

@@ -4,7 +4,7 @@ import { IRetrievalNode } from '@/interfaces/database/flow';
import { NodeProps, Position } from '@xyflow/react';
import classNames from 'classnames';
import { get } from 'lodash';
import { memo, useMemo } from 'react';
import { memo } from 'react';
import { NodeHandleId } from '../../constant';
import { useGetVariableLabelByValue } from '../../hooks/use-get-begin-query';
import { CommonHandle } from './handle';
@@ -21,18 +21,7 @@ function InnerRetrievalNode({
selected,
}: NodeProps<IRetrievalNode>) {
const knowledgeBaseIds: string[] = get(data, 'form.kb_ids', []);
console.log('🚀 ~ InnerRetrievalNode ~ knowledgeBaseIds:', knowledgeBaseIds);
const { list: knowledgeList } = useFetchKnowledgeList(true);
const knowledgeBases = useMemo(() => {
return knowledgeBaseIds.map((x) => {
const item = knowledgeList.find((y) => x === y.id);
return {
name: item?.name,
avatar: item?.avatar,
id: x,
};
});
}, [knowledgeList, knowledgeBaseIds]);

const getLabel = useGetVariableLabelByValue(id);


+ 1
- 5
web/src/pages/agent/form/categorize-form/use-values.ts 查看文件

@@ -1,8 +1,7 @@
import { ModelVariableType } from '@/constants/knowledge';
import { RAGFlowNodeType } from '@/interfaces/database/flow';
import { get, isEmpty, isPlainObject } from 'lodash';
import { isEmpty, isPlainObject } from 'lodash';
import { useMemo } from 'react';
import { buildCategorizeListFromObject } from '../../utils';

const defaultValues = {
parameter: ModelVariableType.Precise,
@@ -21,9 +20,6 @@ export function useValues(node?: RAGFlowNodeType) {
if (isEmpty(formData)) {
return defaultValues;
}
const items = buildCategorizeListFromObject(
get(node, 'data.form.category_description', {}),
);
if (isPlainObject(formData)) {
// const nextValues = {
// ...omit(formData, 'category_description'),

+ 1
- 1
web/src/pages/agent/form/components/next-dynamic-input-variable.tsx 查看文件

@@ -1,6 +1,6 @@
'use client';

import { SideDown } from '@/assets/icon/Icon';
import { SideDown } from '@/assets/icon/next-icon';
import { Button } from '@/components/ui/button';
import {
Collapsible,

+ 0
- 12
web/src/pages/agent/form/relevant-form/hooks.ts 查看文件

@@ -1,4 +1,3 @@
import { Edge } from '@xyflow/react';
import pick from 'lodash/pick';
import { useCallback, useEffect } from 'react';
import { IOperatorForm } from '../../interface';
@@ -21,16 +20,12 @@ export const useBuildRelevantOptions = () => {
return buildRelevantOptions;
};

const getTargetOfEdge = (edges: Edge[], sourceHandle: string) =>
edges.find((x) => x.sourceHandle === sourceHandle)?.target;

/**
* monitor changes in the connection and synchronize the target to the yes and no fields of the form
* similar to the categorize-form's useHandleFormValuesChange method
* @param param0
*/
export const useWatchConnectionChanges = ({ nodeId, form }: IOperatorForm) => {
const edges = useGraphStore((state) => state.edges);
const getNode = useGraphStore((state) => state.getNode);
const node = getNode(nodeId);

@@ -40,13 +35,6 @@ export const useWatchConnectionChanges = ({ nodeId, form }: IOperatorForm) => {
}
}, [node, form]);

const watchConnectionChanges = useCallback(() => {
const edgeList = edges.filter((x) => x.source === nodeId);
const yes = getTargetOfEdge(edgeList, 'yes');
const no = getTargetOfEdge(edgeList, 'no');
form?.setFieldsValue({ yes, no });
}, [edges, nodeId, form]);

useEffect(() => {
watchFormChanges();
}, [watchFormChanges]);

+ 1
- 1
web/src/pages/agent/log-sheet/index.tsx 查看文件

@@ -8,7 +8,7 @@ import { IModalProps } from '@/interfaces/common';
import { NotebookText } from 'lucide-react';
import 'react18-json-view/src/style.css';
import { useCacheChatLog } from '../hooks/use-cache-chat-log';
import { WorkFlowTimeline } from './workFlowTimeline';
import { WorkFlowTimeline } from './workflow-timeline';

type LogSheetProps = IModalProps<any> &
Pick<

web/src/pages/agent/log-sheet/toolTimelineItem.tsx → web/src/pages/agent/log-sheet/tool-timeline-item.tsx 查看文件

@@ -19,7 +19,7 @@ import {
JsonViewer,
toLowerCaseStringAndDeleteChar,
typeMap,
} from './workFlowTimeline';
} from './workflow-timeline';
type IToolIcon =
| Operator.ArXiv
| Operator.GitHub

web/src/pages/agent/log-sheet/workFlowTimeline.tsx → web/src/pages/agent/log-sheet/workflow-timeline.tsx 查看文件

@@ -28,7 +28,7 @@ import JsonView from 'react18-json-view';
import { Operator } from '../constant';
import { useCacheChatLog } from '../hooks/use-cache-chat-log';
import OperatorIcon from '../operator-icon';
import ToolTimelineItem from './toolTimelineItem';
import ToolTimelineItem from './tool-timeline-item';
type LogFlowTimelineProps = Pick<
ReturnType<typeof useCacheChatLog>,
'currentEventListWithoutMessage' | 'currentMessageId'

+ 3
- 5
web/src/pages/chat/chat-configuration-modal/editable-cell.tsx 查看文件

@@ -1,4 +1,5 @@
import { Form, FormInstance, Input, InputRef } from 'antd';
import { omit } from 'lodash';
import React, { useContext, useEffect, useRef, useState } from 'react';

const EditableContext = React.createContext<FormInstance<any> | null>(null);
@@ -14,15 +15,12 @@ interface Item {
address: string;
}

export const EditableRow: React.FC<EditableRowProps> = ({
index,
...props
}) => {
export const EditableRow: React.FC<EditableRowProps> = ({ ...props }) => {
const [form] = Form.useForm();
return (
<Form form={form} component={false}>
<EditableContext.Provider value={form}>
<tr {...props} />
<tr {...omit(props, 'index')} />
</EditableContext.Provider>
</Form>
);

+ 8
- 3
web/src/pages/chat/markdown-content/index.tsx 查看文件

@@ -28,6 +28,7 @@ import {
import { currentReg, replaceTextByOldReg } from '../utils';

import classNames from 'classnames';
import { omit } from 'lodash';
import { pipe } from 'lodash/fp';
import styles from './index.less';

@@ -247,11 +248,12 @@ const MarkdownContent = ({
'custom-typography': ({ children }: { children: string }) =>
renderReference(children),
code(props: any) {
const { children, className, node, ...rest } = props;
const { children, className, ...rest } = props;
const restProps = omit(rest, 'node');
const match = /language-(\w+)/.exec(className || '');
return match ? (
<SyntaxHighlighter
{...rest}
{...restProps}
PreTag="div"
language={match[1]}
wrapLongLines
@@ -259,7 +261,10 @@ const MarkdownContent = ({
{String(children).replace(/\n$/, '')}
</SyntaxHighlighter>
) : (
<code {...rest} className={classNames(className, 'text-wrap')}>
<code
{...restProps}
className={classNames(className, 'text-wrap')}
>
{children}
</code>
);

+ 1
- 1
web/src/pages/chat/shared-hooks.ts 查看文件

@@ -26,7 +26,7 @@ export const useGetSharedChatSearchParams = () => {
const data = Object.fromEntries(
searchParams
.entries()
.filter(([key, value]) => key.startsWith(data_prefix))
.filter(([key]) => key.startsWith(data_prefix))
.map(([key, value]) => [key.replace(data_prefix, ''), value]),
);
return {

+ 0
- 6
web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/components/chunk-creating-modal/index.tsx 查看文件

@@ -19,7 +19,6 @@ import { Switch } from '@/components/ui/switch';
import { Textarea } from '@/components/ui/textarea';
import { useFetchChunk } from '@/hooks/chunk-hooks';
import { IModalProps } from '@/interfaces/common';
import { IChunk } from '@/interfaces/database/knowledge';
import { Trash2 } from 'lucide-react';
import React, { useCallback, useEffect, useState } from 'react';
import { FieldValues, FormProvider, useForm } from 'react-hook-form';
@@ -31,11 +30,6 @@ import {
} from '../../utils';
import { TagFeatureItem } from './tag-feature-item';

type FieldType = Pick<
IChunk,
'content_with_weight' | 'tag_kwd' | 'question_kwd' | 'important_kwd'
>;

interface kFProps {
doc_id: string;
chunkId: string | undefined;

+ 1
- 1
web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/components/document-preview/csv-preview.tsx 查看文件

@@ -36,7 +36,7 @@ const CSVFileViewer: React.FC<FileViewerProps> = () => {
const res = await request(url, {
method: 'GET',
responseType: 'blob',
onError: (err) => {
onError: () => {
message.error('file load failed');
setIsLoading(false);
},

+ 2
- 14
web/src/pages/dataset/testing/index.tsx 查看文件

@@ -1,13 +1,9 @@
import { useTestRetrieval } from '@/hooks/use-knowledge-request';
import { useCallback, useState } from 'react';
import { useState } from 'react';
import { TopTitle } from '../dataset-title';
import TestingForm from './testing-form';
import { TestingResult } from './testing-result';

function Vertical() {
return <div>xxx</div>;
}

export default function RetrievalTesting() {
const {
loading,
@@ -21,15 +17,7 @@ export default function RetrievalTesting() {
filterValue,
} = useTestRetrieval();

const [count, setCount] = useState(1);

const addCount = useCallback(() => {
setCount(2);
}, []);

const removeCount = useCallback(() => {
setCount(1);
}, []);
const [count] = useState(1);

return (
<div className="p-5">

+ 1
- 1
web/src/pages/flow/constant.tsx 查看文件

@@ -3,7 +3,7 @@ import {
KeywordIcon,
QWeatherIcon,
WikipediaIcon,
} from '@/assets/icon/Icon';
} from '@/assets/icon/next-icon';
import { ReactComponent as AkShareIcon } from '@/assets/svg/akshare.svg';
import { ReactComponent as ArXivIcon } from '@/assets/svg/arxiv.svg';
import { ReactComponent as baiduFanyiIcon } from '@/assets/svg/baidu-fanyi.svg';

+ 1
- 1
web/src/pages/flow/form/iteration-from/index.tsx 查看文件

@@ -1,4 +1,4 @@
import { CommaIcon, SemicolonIcon } from '@/assets/icon/Icon';
import { CommaIcon, SemicolonIcon } from '@/assets/icon/next-icon';
import { Form, Select } from 'antd';
import {
CornerDownLeft,

+ 9
- 10
web/src/pages/flow/form/relevant-form/hooks.ts 查看文件

@@ -1,4 +1,3 @@
import { Edge } from '@xyflow/react';
import pick from 'lodash/pick';
import { useCallback, useEffect } from 'react';
import { IOperatorForm } from '../../interface';
@@ -21,8 +20,8 @@ export const useBuildRelevantOptions = () => {
return buildRelevantOptions;
};

const getTargetOfEdge = (edges: Edge[], sourceHandle: string) =>
edges.find((x) => x.sourceHandle === sourceHandle)?.target;
// const getTargetOfEdge = (edges: Edge[], sourceHandle: string) =>
// edges.find((x) => x.sourceHandle === sourceHandle)?.target;

/**
* monitor changes in the connection and synchronize the target to the yes and no fields of the form
@@ -30,7 +29,7 @@ const getTargetOfEdge = (edges: Edge[], sourceHandle: string) =>
* @param param0
*/
export const useWatchConnectionChanges = ({ nodeId, form }: IOperatorForm) => {
const edges = useGraphStore((state) => state.edges);
// const edges = useGraphStore((state) => state.edges);
const getNode = useGraphStore((state) => state.getNode);
const node = getNode(nodeId);

@@ -40,12 +39,12 @@ export const useWatchConnectionChanges = ({ nodeId, form }: IOperatorForm) => {
}
}, [node, form]);

const watchConnectionChanges = useCallback(() => {
const edgeList = edges.filter((x) => x.source === nodeId);
const yes = getTargetOfEdge(edgeList, 'yes');
const no = getTargetOfEdge(edgeList, 'no');
form?.setFieldsValue({ yes, no });
}, [edges, nodeId, form]);
// const watchConnectionChanges = useCallback(() => {
// const edgeList = edges.filter((x) => x.source === nodeId);
// const yes = getTargetOfEdge(edgeList, 'yes');
// const no = getTargetOfEdge(edgeList, 'no');
// form?.setFieldsValue({ yes, no });
// }, [edges, nodeId, form]);

useEffect(() => {
watchFormChanges();

+ 11
- 7
web/src/pages/flow/hooks/use-save-graph.ts 查看文件

@@ -50,10 +50,14 @@ export const useSaveGraphBeforeOpeningDebugDrawer = (show: () => void) => {
};

export const useWatchAgentChange = (chatDrawerVisible: boolean) => {
console.log(
'🚀 ~ useWatchAgentChange ~ chatDrawerVisible:',
chatDrawerVisible,
);
const [time, setTime] = useState<string>();
const nodes = useGraphStore((state) => state.nodes);
const edges = useGraphStore((state) => state.edges);
const { saveGraph } = useSaveGraph();
// const { saveGraph } = useSaveGraph();
const { data: flowDetail } = useFetchFlow();

const setSaveTime = useCallback((updateTime: number) => {
@@ -64,12 +68,12 @@ export const useWatchAgentChange = (chatDrawerVisible: boolean) => {
setSaveTime(flowDetail?.update_time);
}, [flowDetail, setSaveTime]);

const saveAgent = useCallback(async () => {
if (!chatDrawerVisible) {
const ret = await saveGraph();
setSaveTime(ret.data.update_time);
}
}, [chatDrawerVisible, saveGraph, setSaveTime]);
// const saveAgent = useCallback(async () => {
// if (!chatDrawerVisible) {
// const ret = await saveGraph();
// setSaveTime(ret.data.update_time);
// }
// }, [chatDrawerVisible, saveGraph, setSaveTime]);

useDebounceEffect(
() => {

+ 1
- 0
web/src/pages/login-next/hooks.ts 查看文件

@@ -11,6 +11,7 @@ export enum Step {

export const useSwitchStep = (step: Step) => {
const [_, setSearchParams] = useSearchParams();
console.log('🚀 ~ useSwitchStep ~ _:', _);
const switchStep = useCallback(() => {
setSearchParams(new URLSearchParams({ step: step.toString() }));
}, [setSearchParams, step]);

+ 1
- 1
web/src/pages/next-chats/hooks/use-send-shared-message.ts 查看文件

@@ -16,7 +16,7 @@ export const useGetSharedChatSearchParams = () => {
const data = Object.fromEntries(
searchParams
.entries()
.filter(([key, value]) => key.startsWith(data_prefix))
.filter(([key]) => key.startsWith(data_prefix))
.map(([key, value]) => [key.replace(data_prefix, ''), value]),
);
return {

+ 1
- 2
web/src/pages/next-search/search-setting.tsx 查看文件

@@ -116,8 +116,7 @@ const SearchSetting: React.FC<SearchSettingProps> = ({
})();
}
}, [avatarFile]);
const { list: datasetListOrigin, loading: datasetLoading } =
useFetchKnowledgeList();
const { list: datasetListOrigin } = useFetchKnowledgeList();

useEffect(() => {
const datasetListMap = datasetListOrigin.map((item: IKnowledge) => {

+ 1
- 1
web/src/pages/next-searches/index.tsx 查看文件

@@ -30,7 +30,7 @@ type SearchFormValues = z.infer<typeof searchFormSchema>;
export default function SearchList() {
// const { data } = useFetchFlowList();
const { t } = useTranslate('search');
const { isLoading, isError, createSearch } = useCreateSearch();
const { isLoading, createSearch } = useCreateSearch();
const {
data: list,
searchParams,

+ 9
- 2
web/src/pages/search/hooks.ts 查看文件

@@ -24,7 +24,7 @@ export const useSendQuestion = (kbIds: string[]) => {
api.ask,
);
const { testChunk, loading } = useTestChunkRetrieval();
const { testChunkAll, loading: loadingAll } = useTestChunkAllRetrieval();
const { testChunkAll } = useTestChunkAllRetrieval();
const [sendingLoading, setSendingLoading] = useState(false);
const [currentAnswer, setCurrentAnswer] = useState({} as IAnswer);
const { fetchRelatedQuestions, data: relatedQuestions } =
@@ -102,7 +102,14 @@ export const useSendQuestion = (kbIds: string[]) => {
size,
});
},
[sendingLoading, searchStr, kbIds, testChunk, selectedDocumentIds],
[
searchStr,
sendingLoading,
testChunk,
kbIds,
selectedDocumentIds,
testChunkAll,
],
);

useEffect(() => {

+ 1
- 1
web/src/pages/user-setting/constants.tsx 查看文件

@@ -5,7 +5,7 @@ import {
PasswordIcon,
ProfileIcon,
TeamIcon,
} from '@/assets/icon/Icon';
} from '@/assets/icon/next-icon';
import { IconFont } from '@/components/icon-font';
import { LLMFactory } from '@/constants/llm';
import { UserSettingRouteKey } from '@/constants/setting';

+ 1
- 1
web/src/pages/user-setting/setting-locale/index.tsx 查看文件

@@ -1,5 +1,5 @@
import { translationTable } from '@/locales/config';
import TranslationTable from './TranslationTable';
import TranslationTable from './translation-table';

function UserSettingLocale() {
return (

web/src/pages/user-setting/setting-locale/TranslationTable.tsx → web/src/pages/user-setting/setting-locale/translation-table.tsx 查看文件


+ 2
- 2
web/src/pages/user-setting/setting-model/azure-openai-modal/index.tsx 查看文件

@@ -46,7 +46,7 @@ const AzureOpenAIModal = ({
{ value: 'image2text', label: 'image2text' },
],
};
const getOptions = (factory: string) => {
const getOptions = () => {
return optionsMap.Default;
};
const handleKeyDown = async (e: React.KeyboardEvent) => {
@@ -132,7 +132,7 @@ const AzureOpenAIModal = ({
type: 'number',
message: t('maxTokensInvalidMessage'),
},
({ getFieldValue }) => ({
({}) => ({
validator(_, value) {
if (value < 0) {
return Promise.reject(new Error(t('maxTokensMinMessage')));

+ 1
- 1
web/src/pages/user-setting/setting-model/bedrock-modal/index.tsx 查看文件

@@ -121,7 +121,7 @@ const BedrockModal = ({
type: 'number',
message: t('maxTokensInvalidMessage'),
},
({ getFieldValue }) => ({
({}) => ({
validator(_, value) {
if (value < 0) {
return Promise.reject(new Error(t('maxTokensMinMessage')));

+ 1
- 1
web/src/pages/user-setting/setting-model/fish-audio-modal/index.tsx 查看文件

@@ -103,7 +103,7 @@ const FishAudioModal = ({
type: 'number',
message: t('maxTokensInvalidMessage'),
},
({ getFieldValue }) => ({
({}) => ({
validator(_, value) {
if (value < 0) {
return Promise.reject(new Error(t('maxTokensMinMessage')));

+ 1
- 1
web/src/pages/user-setting/setting-model/google-modal/index.tsx 查看文件

@@ -110,7 +110,7 @@ const GoogleModal = ({
type: 'number',
message: t('maxTokensInvalidMessage'),
},
({ getFieldValue }) => ({
({}) => ({
validator(_, value) {
if (value < 0) {
return Promise.reject(new Error(t('maxTokensMinMessage')));

+ 0
- 1
web/src/pages/user-setting/setting-model/hooks.ts 查看文件

@@ -114,7 +114,6 @@ export const useSubmitOllama = () => {
const [initialValues, setInitialValues] = useState<
Partial<IAddLlmRequestBody> | undefined
>();
const [originalModelName, setOriginalModelName] = useState<string>('');
const { addLlm, loading } = useAddLlm();
const {
visible: llmAddingVisible,

+ 1
- 3
web/src/pages/user-setting/setting-model/hunyuan-modal/index.tsx 查看文件

@@ -1,7 +1,7 @@
import { useTranslate } from '@/hooks/common-hooks';
import { IModalProps } from '@/interfaces/common';
import { IAddLlmRequestBody } from '@/interfaces/request/llm';
import { Form, Input, Modal, Select } from 'antd';
import { Form, Input, Modal } from 'antd';
import omit from 'lodash/omit';

type FieldType = IAddLlmRequestBody & {
@@ -10,8 +10,6 @@ type FieldType = IAddLlmRequestBody & {
hunyuan_sk: string;
};

const { Option } = Select;

const HunyuanModal = ({
visible,
hideModal,

+ 1
- 1
web/src/pages/user-setting/setting-model/index.tsx 查看文件

@@ -34,7 +34,6 @@ import { CircleHelp } from 'lucide-react';
import { useCallback, useMemo } from 'react';
import SettingTitle from '../components/setting-title';
import { isLocalLlmFactory } from '../utils';
import TencentCloudModal from './Tencent-modal';
import ApiKeyModal from './api-key-modal';
import AzureOpenAIModal from './azure-openai-modal';
import BedrockModal from './bedrock-modal';
@@ -58,6 +57,7 @@ import {
} from './hooks';
import HunyuanModal from './hunyuan-modal';
import styles from './index.less';
import TencentCloudModal from './next-tencent-modal';
import OllamaModal from './ollama-modal';
import SparkModal from './spark-modal';
import SystemModelSettingModal from './system-model-setting-modal';

web/src/pages/user-setting/setting-model/Tencent-modal/index.tsx → web/src/pages/user-setting/setting-model/next-tencent-modal/index.tsx 查看文件


+ 1
- 1
web/src/pages/user-setting/setting-model/spark-modal/index.tsx 查看文件

@@ -140,7 +140,7 @@ const SparkModal = ({
type: 'number',
message: t('maxTokensInvalidMessage'),
},
({ getFieldValue }) => ({
({}) => ({
validator(_, value) {
if (value < 0) {
return Promise.reject(new Error(t('maxTokensMinMessage')));

+ 1
- 1
web/src/pages/user-setting/setting-model/volcengine-modal/index.tsx 查看文件

@@ -113,7 +113,7 @@ const VolcEngineModal = ({
type: 'number',
message: t('maxTokensInvalidMessage'),
},
({ getFieldValue }) => ({
({}) => ({
validator(_, value) {
if (value < 0) {
return Promise.reject(new Error(t('maxTokensMinMessage')));

+ 1
- 1
web/src/pages/user-setting/setting-model/yiyan-modal/index.tsx 查看文件

@@ -108,7 +108,7 @@ const YiyanModal = ({
type: 'number',
message: t('maxTokensInvalidMessage'),
},
({ getFieldValue }) => ({
({}) => ({
validator(_, value) {
if (value < 0) {
return Promise.reject(new Error(t('maxTokensMinMessage')));

web/src/services/next-chat-service .ts → web/src/services/next-chat-service.ts 查看文件

@@ -4,7 +4,7 @@ import { registerNextServer } from '@/utils/register-server';
const {
getDialog,
setDialog,
listDialog,
// listDialog,
removeDialog,
getConversation,
getConversationSSE,

+ 1
- 0
web/src/utils/register-server.ts 查看文件

@@ -1,3 +1,4 @@
/* eslint-disable guard-for-in */
import { AxiosRequestConfig, AxiosResponse } from 'axios';
import { isObject } from 'lodash';
import omit from 'lodash/omit';

Loading…
取消
儲存