mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### 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)
This commit is contained in:
@ -1,5 +1,43 @@
|
|||||||
// .eslintrc.js
|
// .eslintrc.js
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// Umi 项目
|
|
||||||
extends: [require.resolve('umi/eslint'), 'plugin:react-hooks/recommended'],
|
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: ['"', '"'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import TerserPlugin from 'terser-webpack-plugin';
|
|||||||
import { defineConfig } from 'umi';
|
import { defineConfig } from 'umi';
|
||||||
import { appName } from './src/conf.json';
|
import { appName } from './src/conf.json';
|
||||||
import routes from './src/routes';
|
import routes from './src/routes';
|
||||||
|
const ESLintPlugin = require('eslint-webpack-plugin');
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
title: appName,
|
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.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;
|
return memo;
|
||||||
},
|
},
|
||||||
tailwindcss: {},
|
tailwindcss: {},
|
||||||
|
|||||||
179
web/package-lock.json
generated
179
web/package-lock.json
generated
@ -121,6 +121,8 @@
|
|||||||
"@umijs/plugins": "^4.1.0",
|
"@umijs/plugins": "^4.1.0",
|
||||||
"@welldone-software/why-did-you-render": "^8.0.3",
|
"@welldone-software/why-did-you-render": "^8.0.3",
|
||||||
"cross-env": "^7.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",
|
"html-loader": "^5.1.0",
|
||||||
"husky": "^9.0.11",
|
"husky": "^9.0.11",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
@ -9147,9 +9149,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/eslint": {
|
"node_modules/@types/eslint": {
|
||||||
"version": "8.56.1",
|
"version": "9.6.1",
|
||||||
"resolved": "https://registry.npmmirror.com/@types/eslint/-/eslint-8.56.1.tgz",
|
"resolved": "https://registry.npmmirror.com/@types/eslint/-/eslint-9.6.1.tgz",
|
||||||
"integrity": "sha512-18PLWRzhy9glDQp3+wOgfLYRWlhgX0azxgJ63rdpoUHyrC9z0f5CkFburjQx4uD7ZCruw85ZtMt6K+L+R8fLJQ==",
|
"integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==",
|
||||||
|
"license": "MIT",
|
||||||
"peer": true,
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/estree": "*",
|
"@types/estree": "*",
|
||||||
@ -16334,6 +16337,27 @@
|
|||||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
"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": {
|
"node_modules/eslint-plugin-jest": {
|
||||||
"version": "27.2.3",
|
"version": "27.2.3",
|
||||||
"resolved": "https://registry.npmmirror.com/eslint-plugin-jest/-/eslint-plugin-jest-27.2.3.tgz",
|
"resolved": "https://registry.npmmirror.com/eslint-plugin-jest/-/eslint-plugin-jest-27.2.3.tgz",
|
||||||
@ -16437,6 +16461,141 @@
|
|||||||
"node": ">=10"
|
"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": {
|
"node_modules/eslint/node_modules/ansi-styles": {
|
||||||
"version": "4.3.0",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
"resolved": "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||||
@ -17222,9 +17381,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/flatted": {
|
"node_modules/flatted": {
|
||||||
"version": "3.2.9",
|
"version": "3.3.3",
|
||||||
"resolved": "https://registry.npmmirror.com/flatted/-/flatted-3.2.9.tgz",
|
"resolved": "https://registry.npmmirror.com/flatted/-/flatted-3.3.3.tgz",
|
||||||
"integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==",
|
"integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==",
|
||||||
|
"license": "ISC",
|
||||||
"peer": true
|
"peer": true
|
||||||
},
|
},
|
||||||
"node_modules/flatten": {
|
"node_modules/flatten": {
|
||||||
@ -24121,9 +24281,10 @@
|
|||||||
"integrity": "sha512-oNh6S2WMHWRZrmutsRmDDfkzKtxF+bc2VxLC9dvtrDIRFln627VsFP6fLMgTryGDljgLPjkrzQSDcPrjPyDJ5w=="
|
"integrity": "sha512-oNh6S2WMHWRZrmutsRmDDfkzKtxF+bc2VxLC9dvtrDIRFln627VsFP6fLMgTryGDljgLPjkrzQSDcPrjPyDJ5w=="
|
||||||
},
|
},
|
||||||
"node_modules/micromatch": {
|
"node_modules/micromatch": {
|
||||||
"version": "4.0.7",
|
"version": "4.0.8",
|
||||||
"resolved": "https://registry.npmmirror.com/micromatch/-/micromatch-4.0.7.tgz",
|
"resolved": "https://registry.npmmirror.com/micromatch/-/micromatch-4.0.8.tgz",
|
||||||
"integrity": "sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==",
|
"integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"braces": "^3.0.3",
|
"braces": "^3.0.3",
|
||||||
"picomatch": "^2.3.1"
|
"picomatch": "^2.3.1"
|
||||||
|
|||||||
@ -132,6 +132,8 @@
|
|||||||
"@umijs/plugins": "^4.1.0",
|
"@umijs/plugins": "^4.1.0",
|
||||||
"@welldone-software/why-did-you-render": "^8.0.3",
|
"@welldone-software/why-did-you-render": "^8.0.3",
|
||||||
"cross-env": "^7.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",
|
"html-loader": "^5.1.0",
|
||||||
"husky": "^9.0.11",
|
"husky": "^9.0.11",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
|
|||||||
@ -80,7 +80,6 @@ export function ChunkMethodDialog({
|
|||||||
hideModal,
|
hideModal,
|
||||||
onOk,
|
onOk,
|
||||||
parserId,
|
parserId,
|
||||||
documentId,
|
|
||||||
documentExtension,
|
documentExtension,
|
||||||
visible,
|
visible,
|
||||||
parserConfig,
|
parserConfig,
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import { Form, FormInstance, Input, InputRef, Typography } from 'antd';
|
import { Form, FormInstance, Input, InputRef, Typography } from 'antd';
|
||||||
|
import { omit } from 'lodash';
|
||||||
import React, { useContext, useEffect, useRef, useState } from 'react';
|
import React, { useContext, useEffect, useRef, useState } from 'react';
|
||||||
|
|
||||||
const EditableContext = React.createContext<FormInstance<any> | null>(null);
|
const EditableContext = React.createContext<FormInstance<any> | null>(null);
|
||||||
@ -15,15 +16,12 @@ interface Item {
|
|||||||
address: string;
|
address: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const EditableRow: React.FC<EditableRowProps> = ({
|
export const EditableRow: React.FC<EditableRowProps> = ({ ...props }) => {
|
||||||
index,
|
|
||||||
...props
|
|
||||||
}) => {
|
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
return (
|
return (
|
||||||
<Form form={form} component={false}>
|
<Form form={form} component={false}>
|
||||||
<EditableContext.Provider value={form}>
|
<EditableContext.Provider value={form}>
|
||||||
<tr {...props} />
|
<tr {...omit(props, 'index')} />
|
||||||
</EditableContext.Provider>
|
</EditableContext.Provider>
|
||||||
</Form>
|
</Form>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -31,7 +31,7 @@ const HightLightMarkdown = ({
|
|||||||
components={
|
components={
|
||||||
{
|
{
|
||||||
code(props: any) {
|
code(props: any) {
|
||||||
const { children, className, node, ...rest } = props;
|
const { children, className, ...rest } = props;
|
||||||
const match = /language-(\w+)/.exec(className || '');
|
const match = /language-(\w+)/.exec(className || '');
|
||||||
return match ? (
|
return match ? (
|
||||||
<SyntaxHighlighter
|
<SyntaxHighlighter
|
||||||
|
|||||||
@ -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 CopyToClipboard from '@/components/copy-to-clipboard';
|
||||||
import { useSetModalState } from '@/hooks/common-hooks';
|
import { useSetModalState } from '@/hooks/common-hooks';
|
||||||
import { IRemoveMessageById } from '@/hooks/logic-hooks';
|
import { IRemoveMessageById } from '@/hooks/logic-hooks';
|
||||||
|
|||||||
@ -27,6 +27,7 @@ import {
|
|||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import { currentReg, replaceTextByOldReg } from '@/pages/chat/utils';
|
import { currentReg, replaceTextByOldReg } from '@/pages/chat/utils';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
import { omit } from 'lodash';
|
||||||
import { pipe } from 'lodash/fp';
|
import { pipe } from 'lodash/fp';
|
||||||
import { CircleAlert } from 'lucide-react';
|
import { CircleAlert } from 'lucide-react';
|
||||||
import { Button } from '../ui/button';
|
import { Button } from '../ui/button';
|
||||||
@ -256,11 +257,12 @@ function MarkdownContent({
|
|||||||
'custom-typography': ({ children }: { children: string }) =>
|
'custom-typography': ({ children }: { children: string }) =>
|
||||||
renderReference(children),
|
renderReference(children),
|
||||||
code(props: any) {
|
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 || '');
|
const match = /language-(\w+)/.exec(className || '');
|
||||||
return match ? (
|
return match ? (
|
||||||
<SyntaxHighlighter
|
<SyntaxHighlighter
|
||||||
{...rest}
|
{...restProps}
|
||||||
PreTag="div"
|
PreTag="div"
|
||||||
language={match[1]}
|
language={match[1]}
|
||||||
wrapLongLines
|
wrapLongLines
|
||||||
@ -268,7 +270,10 @@ function MarkdownContent({
|
|||||||
{String(children).replace(/\n$/, '')}
|
{String(children).replace(/\n$/, '')}
|
||||||
</SyntaxHighlighter>
|
</SyntaxHighlighter>
|
||||||
) : (
|
) : (
|
||||||
<code {...rest} className={classNames(className, 'text-wrap')}>
|
<code
|
||||||
|
{...restProps}
|
||||||
|
className={classNames(className, 'text-wrap')}
|
||||||
|
>
|
||||||
{children}
|
{children}
|
||||||
</code>
|
</code>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -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 CopyToClipboard from '@/components/copy-to-clipboard';
|
||||||
import { useSetModalState } from '@/hooks/common-hooks';
|
import { useSetModalState } from '@/hooks/common-hooks';
|
||||||
import { IRemoveMessageById } from '@/hooks/logic-hooks';
|
import { IRemoveMessageById } from '@/hooks/logic-hooks';
|
||||||
|
|||||||
@ -17,7 +17,7 @@ import { IRegenerateMessage, IRemoveMessageById } from '@/hooks/logic-hooks';
|
|||||||
import { INodeEvent, MessageEventType } from '@/hooks/use-send-message';
|
import { INodeEvent, MessageEventType } from '@/hooks/use-send-message';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import { AgentChatContext } from '@/pages/agent/context';
|
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 { IMessage } from '@/pages/chat/interface';
|
||||||
import { isEmpty } from 'lodash';
|
import { isEmpty } from 'lodash';
|
||||||
import { Atom, ChevronDown, ChevronUp } from 'lucide-react';
|
import { Atom, ChevronDown, ChevronUp } from 'lucide-react';
|
||||||
|
|||||||
@ -124,7 +124,7 @@ interface TimelineIndicatorProps extends React.HTMLAttributes<HTMLDivElement> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function TimelineIndicator({
|
function TimelineIndicator({
|
||||||
asChild = false,
|
// asChild = false,
|
||||||
className,
|
className,
|
||||||
children,
|
children,
|
||||||
...props
|
...props
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import { Input } from '@/components/originui/input';
|
import { Input } from '@/components/originui/input';
|
||||||
import { useTranslate } from '@/hooks/common-hooks';
|
|
||||||
import { EyeIcon, EyeOffIcon } from 'lucide-react';
|
import { EyeIcon, EyeOffIcon } from 'lucide-react';
|
||||||
import { ChangeEvent, LegacyRef, forwardRef, useId, useState } from 'react';
|
import { ChangeEvent, forwardRef, useId, useState } from 'react';
|
||||||
|
|
||||||
type PropType = {
|
type PropType = {
|
||||||
name: string;
|
name: string;
|
||||||
@ -10,17 +9,12 @@ type PropType = {
|
|||||||
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
function PasswordInput(
|
function PasswordInput(props: PropType) {
|
||||||
props: PropType,
|
|
||||||
ref: LegacyRef<HTMLInputElement> | undefined,
|
|
||||||
) {
|
|
||||||
const id = useId();
|
const id = useId();
|
||||||
const [isVisible, setIsVisible] = useState<boolean>(false);
|
const [isVisible, setIsVisible] = useState<boolean>(false);
|
||||||
|
|
||||||
const toggleVisibility = () => setIsVisible((prevState) => !prevState);
|
const toggleVisibility = () => setIsVisible((prevState) => !prevState);
|
||||||
|
|
||||||
const { t } = useTranslate('setting');
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="*:not-first:mt-2 w-full">
|
<div className="*:not-first:mt-2 w-full">
|
||||||
{/* <Label htmlFor={id}>Show/hide password input</Label> */}
|
{/* <Label htmlFor={id}>Show/hide password input</Label> */}
|
||||||
|
|||||||
@ -39,7 +39,7 @@ const CommandInput = React.forwardRef<
|
|||||||
React.ElementRef<typeof CommandPrimitive.Input>,
|
React.ElementRef<typeof CommandPrimitive.Input>,
|
||||||
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
|
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
|
||||||
>(({ className, ...props }, ref) => (
|
>(({ 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" />
|
<Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
|
||||||
<CommandPrimitive.Input
|
<CommandPrimitive.Input
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
|||||||
@ -196,7 +196,7 @@ export const MultiSelect = React.forwardRef<
|
|||||||
animation = 0,
|
animation = 0,
|
||||||
maxCount = 3,
|
maxCount = 3,
|
||||||
modalPopover = false,
|
modalPopover = false,
|
||||||
asChild = false,
|
// asChild = false,
|
||||||
className,
|
className,
|
||||||
showSelectAll = true,
|
showSelectAll = true,
|
||||||
...props
|
...props
|
||||||
|
|||||||
@ -26,7 +26,7 @@ const SIDEBAR_WIDTH_MOBILE = '18rem';
|
|||||||
const SIDEBAR_WIDTH_ICON = '3rem';
|
const SIDEBAR_WIDTH_ICON = '3rem';
|
||||||
const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
|
const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
|
||||||
|
|
||||||
type SidebarContext = {
|
type SidebarContextType = {
|
||||||
state: 'expanded' | 'collapsed';
|
state: 'expanded' | 'collapsed';
|
||||||
open: boolean;
|
open: boolean;
|
||||||
setOpen: (open: boolean) => void;
|
setOpen: (open: boolean) => void;
|
||||||
@ -36,7 +36,7 @@ type SidebarContext = {
|
|||||||
toggleSidebar: () => void;
|
toggleSidebar: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const SidebarContext = React.createContext<SidebarContext | null>(null);
|
const SidebarContext = React.createContext<SidebarContextType | null>(null);
|
||||||
|
|
||||||
function useSidebar() {
|
function useSidebar() {
|
||||||
const context = React.useContext(SidebarContext);
|
const context = React.useContext(SidebarContext);
|
||||||
@ -116,7 +116,7 @@ const SidebarProvider = React.forwardRef<
|
|||||||
// This makes it easier to style the sidebar with Tailwind classes.
|
// This makes it easier to style the sidebar with Tailwind classes.
|
||||||
const state = open ? 'expanded' : 'collapsed';
|
const state = open ? 'expanded' : 'collapsed';
|
||||||
|
|
||||||
const contextValue = React.useMemo<SidebarContext>(
|
const contextValue = React.useMemo<SidebarContextType>(
|
||||||
() => ({
|
() => ({
|
||||||
state,
|
state,
|
||||||
open,
|
open,
|
||||||
@ -580,11 +580,8 @@ const SidebarMenuButton = React.forwardRef<
|
|||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof tooltip === 'string') {
|
const tooltipContent =
|
||||||
tooltip = {
|
typeof tooltip === 'string' ? { children: tooltip } : tooltip;
|
||||||
children: tooltip,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
@ -593,7 +590,7 @@ const SidebarMenuButton = React.forwardRef<
|
|||||||
side="right"
|
side="right"
|
||||||
align="center"
|
align="center"
|
||||||
hidden={state !== 'collapsed' || isMobile}
|
hidden={state !== 'collapsed' || isMobile}
|
||||||
{...tooltip}
|
{...tooltipContent}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -27,7 +27,7 @@ import { useTranslate } from './common-hooks';
|
|||||||
import { useSetPaginationParams } from './route-hook';
|
import { useSetPaginationParams } from './route-hook';
|
||||||
import { useFetchTenantInfo, useSaveSetting } from './user-setting-hooks';
|
import { useFetchTenantInfo, useSaveSetting } from './user-setting-hooks';
|
||||||
|
|
||||||
function usePrevious<T>(value: T) {
|
export function usePrevious<T>(value: T) {
|
||||||
const ref = useRef<T>();
|
const ref = useRef<T>();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
ref.current = value;
|
ref.current = value;
|
||||||
|
|||||||
@ -368,16 +368,7 @@ export const useUploadCanvasFileWithProgress = (
|
|||||||
{
|
{
|
||||||
url: api.uploadAgentFile(identifier || id),
|
url: api.uploadAgentFile(identifier || id),
|
||||||
data: formData,
|
data: formData,
|
||||||
onUploadProgress: ({
|
onUploadProgress: ({ progress }) => {
|
||||||
loaded,
|
|
||||||
total,
|
|
||||||
progress,
|
|
||||||
bytes,
|
|
||||||
estimated,
|
|
||||||
rate,
|
|
||||||
upload,
|
|
||||||
lengthComputable,
|
|
||||||
}) => {
|
|
||||||
files.forEach((file) => {
|
files.forEach((file) => {
|
||||||
onProgress(file, (progress || 0) * 100);
|
onProgress(file, (progress || 0) * 100);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import { IAskRequestBody } from '@/interfaces/request/chat';
|
|||||||
import { IClientConversation } from '@/pages/next-chats/chat/interface';
|
import { IClientConversation } from '@/pages/next-chats/chat/interface';
|
||||||
import { useGetSharedChatSearchParams } from '@/pages/next-chats/hooks/use-send-shared-message';
|
import { useGetSharedChatSearchParams } from '@/pages/next-chats/hooks/use-send-shared-message';
|
||||||
import { isConversationIdExist } from '@/pages/next-chats/utils';
|
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 { buildMessageListWithUuid, getConversationId } from '@/utils/chat';
|
||||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
||||||
import { useDebounce } from 'ahooks';
|
import { useDebounce } from 'ahooks';
|
||||||
|
|||||||
@ -13,8 +13,7 @@ import { LanguageList, LanguageMap, ThemeEnum } from '@/constants/common';
|
|||||||
import { useChangeLanguage } from '@/hooks/logic-hooks';
|
import { useChangeLanguage } from '@/hooks/logic-hooks';
|
||||||
import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks';
|
import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks';
|
||||||
import { useNavigateWithFromState } from '@/hooks/route-hook';
|
import { useNavigateWithFromState } from '@/hooks/route-hook';
|
||||||
import { useFetchUserInfo, useListTenant } from '@/hooks/user-setting-hooks';
|
import { useFetchUserInfo } from '@/hooks/user-setting-hooks';
|
||||||
import { TenantRole } from '@/pages/user-setting/constants';
|
|
||||||
import { Routes } from '@/routes';
|
import { Routes } from '@/routes';
|
||||||
import { camelCase } from 'lodash';
|
import { camelCase } from 'lodash';
|
||||||
import {
|
import {
|
||||||
@ -55,11 +54,11 @@ export function Header() {
|
|||||||
changeLanguage(key);
|
changeLanguage(key);
|
||||||
};
|
};
|
||||||
|
|
||||||
const { data } = useListTenant();
|
// const { data } = useListTenant();
|
||||||
|
|
||||||
const showBell = useMemo(() => {
|
// const showBell = useMemo(() => {
|
||||||
return data.some((x) => x.role === TenantRole.Invite);
|
// return data.some((x) => x.role === TenantRole.Invite);
|
||||||
}, [data]);
|
// }, [data]);
|
||||||
|
|
||||||
const items = LanguageList.map((x) => ({
|
const items = LanguageList.map((x) => ({
|
||||||
key: x,
|
key: x,
|
||||||
@ -70,9 +69,9 @@ export function Header() {
|
|||||||
setTheme(theme === ThemeEnum.Dark ? ThemeEnum.Light : ThemeEnum.Dark);
|
setTheme(theme === ThemeEnum.Dark ? ThemeEnum.Light : ThemeEnum.Dark);
|
||||||
}, [setTheme, theme]);
|
}, [setTheme, theme]);
|
||||||
|
|
||||||
const handleBellClick = useCallback(() => {
|
// const handleBellClick = useCallback(() => {
|
||||||
navigate('/user-setting/team');
|
// navigate('/user-setting/team');
|
||||||
}, [navigate]);
|
// }, [navigate]);
|
||||||
|
|
||||||
const tagsData = useMemo(
|
const tagsData = useMemo(
|
||||||
() => [
|
() => [
|
||||||
|
|||||||
@ -147,7 +147,7 @@ export const useHandleUploadDocument = () => {
|
|||||||
const [fileList, setFileList] = useState<UploadFile[]>([]);
|
const [fileList, setFileList] = useState<UploadFile[]>([]);
|
||||||
const [uploadProgress, setUploadProgress] = useState<number>(0);
|
const [uploadProgress, setUploadProgress] = useState<number>(0);
|
||||||
const { uploadDocument, loading } = useUploadNextDocument();
|
const { uploadDocument, loading } = useUploadNextDocument();
|
||||||
const { runDocumentByIds, loading: _ } = useRunNextDocument();
|
const { runDocumentByIds } = useRunNextDocument();
|
||||||
|
|
||||||
const onDocumentUploadOk = useCallback(
|
const onDocumentUploadOk = useCallback(
|
||||||
async ({
|
async ({
|
||||||
|
|||||||
@ -168,7 +168,7 @@ const KnowledgeFile = () => {
|
|||||||
),
|
),
|
||||||
dataIndex: 'run',
|
dataIndex: 'run',
|
||||||
key: 'run',
|
key: 'run',
|
||||||
filters: Object.entries(RunningStatus).map(([key, value]) => ({
|
filters: Object.values(RunningStatus).map((value) => ({
|
||||||
text: t(`runningStatus${value}`),
|
text: t(`runningStatus${value}`),
|
||||||
value: value,
|
value: value,
|
||||||
})),
|
})),
|
||||||
|
|||||||
@ -27,7 +27,6 @@ const KnowledgeSidebar = () => {
|
|||||||
const { knowledgeId } = useGetKnowledgeSearchParams();
|
const { knowledgeId } = useGetKnowledgeSearchParams();
|
||||||
|
|
||||||
const [windowWidth, setWindowWidth] = useState(getWidth());
|
const [windowWidth, setWindowWidth] = useState(getWidth());
|
||||||
const [collapsed, setCollapsed] = useState(false);
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { data: knowledgeDetails } = useFetchKnowledgeBaseConfiguration();
|
const { data: knowledgeDetails } = useFetchKnowledgeBaseConfiguration();
|
||||||
|
|
||||||
@ -92,14 +91,6 @@ const KnowledgeSidebar = () => {
|
|||||||
return list;
|
return list;
|
||||||
}, [data, getItem]);
|
}, [data, getItem]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (windowWidth.width > 957) {
|
|
||||||
setCollapsed(false);
|
|
||||||
} else {
|
|
||||||
setCollapsed(true);
|
|
||||||
}
|
|
||||||
}, [windowWidth.width]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const widthSize = () => {
|
const widthSize = () => {
|
||||||
const width = getWidth();
|
const width = getWidth();
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import { IRetrievalNode } from '@/interfaces/database/flow';
|
|||||||
import { NodeProps, Position } from '@xyflow/react';
|
import { NodeProps, Position } from '@xyflow/react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { get } from 'lodash';
|
import { get } from 'lodash';
|
||||||
import { memo, useMemo } from 'react';
|
import { memo } from 'react';
|
||||||
import { NodeHandleId } from '../../constant';
|
import { NodeHandleId } from '../../constant';
|
||||||
import { useGetVariableLabelByValue } from '../../hooks/use-get-begin-query';
|
import { useGetVariableLabelByValue } from '../../hooks/use-get-begin-query';
|
||||||
import { CommonHandle } from './handle';
|
import { CommonHandle } from './handle';
|
||||||
@ -21,18 +21,7 @@ function InnerRetrievalNode({
|
|||||||
selected,
|
selected,
|
||||||
}: NodeProps<IRetrievalNode>) {
|
}: NodeProps<IRetrievalNode>) {
|
||||||
const knowledgeBaseIds: string[] = get(data, 'form.kb_ids', []);
|
const knowledgeBaseIds: string[] = get(data, 'form.kb_ids', []);
|
||||||
console.log('🚀 ~ InnerRetrievalNode ~ knowledgeBaseIds:', knowledgeBaseIds);
|
|
||||||
const { list: knowledgeList } = useFetchKnowledgeList(true);
|
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);
|
const getLabel = useGetVariableLabelByValue(id);
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
import { ModelVariableType } from '@/constants/knowledge';
|
import { ModelVariableType } from '@/constants/knowledge';
|
||||||
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||||
import { get, isEmpty, isPlainObject } from 'lodash';
|
import { isEmpty, isPlainObject } from 'lodash';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { buildCategorizeListFromObject } from '../../utils';
|
|
||||||
|
|
||||||
const defaultValues = {
|
const defaultValues = {
|
||||||
parameter: ModelVariableType.Precise,
|
parameter: ModelVariableType.Precise,
|
||||||
@ -21,9 +20,6 @@ export function useValues(node?: RAGFlowNodeType) {
|
|||||||
if (isEmpty(formData)) {
|
if (isEmpty(formData)) {
|
||||||
return defaultValues;
|
return defaultValues;
|
||||||
}
|
}
|
||||||
const items = buildCategorizeListFromObject(
|
|
||||||
get(node, 'data.form.category_description', {}),
|
|
||||||
);
|
|
||||||
if (isPlainObject(formData)) {
|
if (isPlainObject(formData)) {
|
||||||
// const nextValues = {
|
// const nextValues = {
|
||||||
// ...omit(formData, 'category_description'),
|
// ...omit(formData, 'category_description'),
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { SideDown } from '@/assets/icon/Icon';
|
import { SideDown } from '@/assets/icon/next-icon';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import {
|
import {
|
||||||
Collapsible,
|
Collapsible,
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import { Edge } from '@xyflow/react';
|
|
||||||
import pick from 'lodash/pick';
|
import pick from 'lodash/pick';
|
||||||
import { useCallback, useEffect } from 'react';
|
import { useCallback, useEffect } from 'react';
|
||||||
import { IOperatorForm } from '../../interface';
|
import { IOperatorForm } from '../../interface';
|
||||||
@ -21,16 +20,12 @@ export const useBuildRelevantOptions = () => {
|
|||||||
return buildRelevantOptions;
|
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
|
* 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
|
* similar to the categorize-form's useHandleFormValuesChange method
|
||||||
* @param param0
|
* @param param0
|
||||||
*/
|
*/
|
||||||
export const useWatchConnectionChanges = ({ nodeId, form }: IOperatorForm) => {
|
export const useWatchConnectionChanges = ({ nodeId, form }: IOperatorForm) => {
|
||||||
const edges = useGraphStore((state) => state.edges);
|
|
||||||
const getNode = useGraphStore((state) => state.getNode);
|
const getNode = useGraphStore((state) => state.getNode);
|
||||||
const node = getNode(nodeId);
|
const node = getNode(nodeId);
|
||||||
|
|
||||||
@ -40,13 +35,6 @@ export const useWatchConnectionChanges = ({ nodeId, form }: IOperatorForm) => {
|
|||||||
}
|
}
|
||||||
}, [node, form]);
|
}, [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(() => {
|
useEffect(() => {
|
||||||
watchFormChanges();
|
watchFormChanges();
|
||||||
}, [watchFormChanges]);
|
}, [watchFormChanges]);
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import { IModalProps } from '@/interfaces/common';
|
|||||||
import { NotebookText } from 'lucide-react';
|
import { NotebookText } from 'lucide-react';
|
||||||
import 'react18-json-view/src/style.css';
|
import 'react18-json-view/src/style.css';
|
||||||
import { useCacheChatLog } from '../hooks/use-cache-chat-log';
|
import { useCacheChatLog } from '../hooks/use-cache-chat-log';
|
||||||
import { WorkFlowTimeline } from './workFlowTimeline';
|
import { WorkFlowTimeline } from './workflow-timeline';
|
||||||
|
|
||||||
type LogSheetProps = IModalProps<any> &
|
type LogSheetProps = IModalProps<any> &
|
||||||
Pick<
|
Pick<
|
||||||
|
|||||||
@ -19,7 +19,7 @@ import {
|
|||||||
JsonViewer,
|
JsonViewer,
|
||||||
toLowerCaseStringAndDeleteChar,
|
toLowerCaseStringAndDeleteChar,
|
||||||
typeMap,
|
typeMap,
|
||||||
} from './workFlowTimeline';
|
} from './workflow-timeline';
|
||||||
type IToolIcon =
|
type IToolIcon =
|
||||||
| Operator.ArXiv
|
| Operator.ArXiv
|
||||||
| Operator.GitHub
|
| Operator.GitHub
|
||||||
@ -28,7 +28,7 @@ import JsonView from 'react18-json-view';
|
|||||||
import { Operator } from '../constant';
|
import { Operator } from '../constant';
|
||||||
import { useCacheChatLog } from '../hooks/use-cache-chat-log';
|
import { useCacheChatLog } from '../hooks/use-cache-chat-log';
|
||||||
import OperatorIcon from '../operator-icon';
|
import OperatorIcon from '../operator-icon';
|
||||||
import ToolTimelineItem from './toolTimelineItem';
|
import ToolTimelineItem from './tool-timeline-item';
|
||||||
type LogFlowTimelineProps = Pick<
|
type LogFlowTimelineProps = Pick<
|
||||||
ReturnType<typeof useCacheChatLog>,
|
ReturnType<typeof useCacheChatLog>,
|
||||||
'currentEventListWithoutMessage' | 'currentMessageId'
|
'currentEventListWithoutMessage' | 'currentMessageId'
|
||||||
@ -1,4 +1,5 @@
|
|||||||
import { Form, FormInstance, Input, InputRef } from 'antd';
|
import { Form, FormInstance, Input, InputRef } from 'antd';
|
||||||
|
import { omit } from 'lodash';
|
||||||
import React, { useContext, useEffect, useRef, useState } from 'react';
|
import React, { useContext, useEffect, useRef, useState } from 'react';
|
||||||
|
|
||||||
const EditableContext = React.createContext<FormInstance<any> | null>(null);
|
const EditableContext = React.createContext<FormInstance<any> | null>(null);
|
||||||
@ -14,15 +15,12 @@ interface Item {
|
|||||||
address: string;
|
address: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const EditableRow: React.FC<EditableRowProps> = ({
|
export const EditableRow: React.FC<EditableRowProps> = ({ ...props }) => {
|
||||||
index,
|
|
||||||
...props
|
|
||||||
}) => {
|
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
return (
|
return (
|
||||||
<Form form={form} component={false}>
|
<Form form={form} component={false}>
|
||||||
<EditableContext.Provider value={form}>
|
<EditableContext.Provider value={form}>
|
||||||
<tr {...props} />
|
<tr {...omit(props, 'index')} />
|
||||||
</EditableContext.Provider>
|
</EditableContext.Provider>
|
||||||
</Form>
|
</Form>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -28,6 +28,7 @@ import {
|
|||||||
import { currentReg, replaceTextByOldReg } from '../utils';
|
import { currentReg, replaceTextByOldReg } from '../utils';
|
||||||
|
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
import { omit } from 'lodash';
|
||||||
import { pipe } from 'lodash/fp';
|
import { pipe } from 'lodash/fp';
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
|
|
||||||
@ -247,11 +248,12 @@ const MarkdownContent = ({
|
|||||||
'custom-typography': ({ children }: { children: string }) =>
|
'custom-typography': ({ children }: { children: string }) =>
|
||||||
renderReference(children),
|
renderReference(children),
|
||||||
code(props: any) {
|
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 || '');
|
const match = /language-(\w+)/.exec(className || '');
|
||||||
return match ? (
|
return match ? (
|
||||||
<SyntaxHighlighter
|
<SyntaxHighlighter
|
||||||
{...rest}
|
{...restProps}
|
||||||
PreTag="div"
|
PreTag="div"
|
||||||
language={match[1]}
|
language={match[1]}
|
||||||
wrapLongLines
|
wrapLongLines
|
||||||
@ -259,7 +261,10 @@ const MarkdownContent = ({
|
|||||||
{String(children).replace(/\n$/, '')}
|
{String(children).replace(/\n$/, '')}
|
||||||
</SyntaxHighlighter>
|
</SyntaxHighlighter>
|
||||||
) : (
|
) : (
|
||||||
<code {...rest} className={classNames(className, 'text-wrap')}>
|
<code
|
||||||
|
{...restProps}
|
||||||
|
className={classNames(className, 'text-wrap')}
|
||||||
|
>
|
||||||
{children}
|
{children}
|
||||||
</code>
|
</code>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -26,7 +26,7 @@ export const useGetSharedChatSearchParams = () => {
|
|||||||
const data = Object.fromEntries(
|
const data = Object.fromEntries(
|
||||||
searchParams
|
searchParams
|
||||||
.entries()
|
.entries()
|
||||||
.filter(([key, value]) => key.startsWith(data_prefix))
|
.filter(([key]) => key.startsWith(data_prefix))
|
||||||
.map(([key, value]) => [key.replace(data_prefix, ''), value]),
|
.map(([key, value]) => [key.replace(data_prefix, ''), value]),
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -19,7 +19,6 @@ import { Switch } from '@/components/ui/switch';
|
|||||||
import { Textarea } from '@/components/ui/textarea';
|
import { Textarea } from '@/components/ui/textarea';
|
||||||
import { useFetchChunk } from '@/hooks/chunk-hooks';
|
import { useFetchChunk } from '@/hooks/chunk-hooks';
|
||||||
import { IModalProps } from '@/interfaces/common';
|
import { IModalProps } from '@/interfaces/common';
|
||||||
import { IChunk } from '@/interfaces/database/knowledge';
|
|
||||||
import { Trash2 } from 'lucide-react';
|
import { Trash2 } from 'lucide-react';
|
||||||
import React, { useCallback, useEffect, useState } from 'react';
|
import React, { useCallback, useEffect, useState } from 'react';
|
||||||
import { FieldValues, FormProvider, useForm } from 'react-hook-form';
|
import { FieldValues, FormProvider, useForm } from 'react-hook-form';
|
||||||
@ -31,11 +30,6 @@ import {
|
|||||||
} from '../../utils';
|
} from '../../utils';
|
||||||
import { TagFeatureItem } from './tag-feature-item';
|
import { TagFeatureItem } from './tag-feature-item';
|
||||||
|
|
||||||
type FieldType = Pick<
|
|
||||||
IChunk,
|
|
||||||
'content_with_weight' | 'tag_kwd' | 'question_kwd' | 'important_kwd'
|
|
||||||
>;
|
|
||||||
|
|
||||||
interface kFProps {
|
interface kFProps {
|
||||||
doc_id: string;
|
doc_id: string;
|
||||||
chunkId: string | undefined;
|
chunkId: string | undefined;
|
||||||
|
|||||||
@ -36,7 +36,7 @@ const CSVFileViewer: React.FC<FileViewerProps> = () => {
|
|||||||
const res = await request(url, {
|
const res = await request(url, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
responseType: 'blob',
|
responseType: 'blob',
|
||||||
onError: (err) => {
|
onError: () => {
|
||||||
message.error('file load failed');
|
message.error('file load failed');
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,13 +1,9 @@
|
|||||||
import { useTestRetrieval } from '@/hooks/use-knowledge-request';
|
import { useTestRetrieval } from '@/hooks/use-knowledge-request';
|
||||||
import { useCallback, useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { TopTitle } from '../dataset-title';
|
import { TopTitle } from '../dataset-title';
|
||||||
import TestingForm from './testing-form';
|
import TestingForm from './testing-form';
|
||||||
import { TestingResult } from './testing-result';
|
import { TestingResult } from './testing-result';
|
||||||
|
|
||||||
function Vertical() {
|
|
||||||
return <div>xxx</div>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function RetrievalTesting() {
|
export default function RetrievalTesting() {
|
||||||
const {
|
const {
|
||||||
loading,
|
loading,
|
||||||
@ -21,15 +17,7 @@ export default function RetrievalTesting() {
|
|||||||
filterValue,
|
filterValue,
|
||||||
} = useTestRetrieval();
|
} = useTestRetrieval();
|
||||||
|
|
||||||
const [count, setCount] = useState(1);
|
const [count] = useState(1);
|
||||||
|
|
||||||
const addCount = useCallback(() => {
|
|
||||||
setCount(2);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const removeCount = useCallback(() => {
|
|
||||||
setCount(1);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="p-5">
|
<div className="p-5">
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import {
|
|||||||
KeywordIcon,
|
KeywordIcon,
|
||||||
QWeatherIcon,
|
QWeatherIcon,
|
||||||
WikipediaIcon,
|
WikipediaIcon,
|
||||||
} from '@/assets/icon/Icon';
|
} from '@/assets/icon/next-icon';
|
||||||
import { ReactComponent as AkShareIcon } from '@/assets/svg/akshare.svg';
|
import { ReactComponent as AkShareIcon } from '@/assets/svg/akshare.svg';
|
||||||
import { ReactComponent as ArXivIcon } from '@/assets/svg/arxiv.svg';
|
import { ReactComponent as ArXivIcon } from '@/assets/svg/arxiv.svg';
|
||||||
import { ReactComponent as baiduFanyiIcon } from '@/assets/svg/baidu-fanyi.svg';
|
import { ReactComponent as baiduFanyiIcon } from '@/assets/svg/baidu-fanyi.svg';
|
||||||
|
|||||||
@ -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 { Form, Select } from 'antd';
|
||||||
import {
|
import {
|
||||||
CornerDownLeft,
|
CornerDownLeft,
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import { Edge } from '@xyflow/react';
|
|
||||||
import pick from 'lodash/pick';
|
import pick from 'lodash/pick';
|
||||||
import { useCallback, useEffect } from 'react';
|
import { useCallback, useEffect } from 'react';
|
||||||
import { IOperatorForm } from '../../interface';
|
import { IOperatorForm } from '../../interface';
|
||||||
@ -21,8 +20,8 @@ export const useBuildRelevantOptions = () => {
|
|||||||
return buildRelevantOptions;
|
return buildRelevantOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getTargetOfEdge = (edges: Edge[], sourceHandle: string) =>
|
// const getTargetOfEdge = (edges: Edge[], sourceHandle: string) =>
|
||||||
edges.find((x) => x.sourceHandle === sourceHandle)?.target;
|
// 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
|
* 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
|
* @param param0
|
||||||
*/
|
*/
|
||||||
export const useWatchConnectionChanges = ({ nodeId, form }: IOperatorForm) => {
|
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 getNode = useGraphStore((state) => state.getNode);
|
||||||
const node = getNode(nodeId);
|
const node = getNode(nodeId);
|
||||||
|
|
||||||
@ -40,12 +39,12 @@ export const useWatchConnectionChanges = ({ nodeId, form }: IOperatorForm) => {
|
|||||||
}
|
}
|
||||||
}, [node, form]);
|
}, [node, form]);
|
||||||
|
|
||||||
const watchConnectionChanges = useCallback(() => {
|
// const watchConnectionChanges = useCallback(() => {
|
||||||
const edgeList = edges.filter((x) => x.source === nodeId);
|
// const edgeList = edges.filter((x) => x.source === nodeId);
|
||||||
const yes = getTargetOfEdge(edgeList, 'yes');
|
// const yes = getTargetOfEdge(edgeList, 'yes');
|
||||||
const no = getTargetOfEdge(edgeList, 'no');
|
// const no = getTargetOfEdge(edgeList, 'no');
|
||||||
form?.setFieldsValue({ yes, no });
|
// form?.setFieldsValue({ yes, no });
|
||||||
}, [edges, nodeId, form]);
|
// }, [edges, nodeId, form]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
watchFormChanges();
|
watchFormChanges();
|
||||||
|
|||||||
@ -50,10 +50,14 @@ export const useSaveGraphBeforeOpeningDebugDrawer = (show: () => void) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const useWatchAgentChange = (chatDrawerVisible: boolean) => {
|
export const useWatchAgentChange = (chatDrawerVisible: boolean) => {
|
||||||
|
console.log(
|
||||||
|
'🚀 ~ useWatchAgentChange ~ chatDrawerVisible:',
|
||||||
|
chatDrawerVisible,
|
||||||
|
);
|
||||||
const [time, setTime] = useState<string>();
|
const [time, setTime] = useState<string>();
|
||||||
const nodes = useGraphStore((state) => state.nodes);
|
const nodes = useGraphStore((state) => state.nodes);
|
||||||
const edges = useGraphStore((state) => state.edges);
|
const edges = useGraphStore((state) => state.edges);
|
||||||
const { saveGraph } = useSaveGraph();
|
// const { saveGraph } = useSaveGraph();
|
||||||
const { data: flowDetail } = useFetchFlow();
|
const { data: flowDetail } = useFetchFlow();
|
||||||
|
|
||||||
const setSaveTime = useCallback((updateTime: number) => {
|
const setSaveTime = useCallback((updateTime: number) => {
|
||||||
@ -64,12 +68,12 @@ export const useWatchAgentChange = (chatDrawerVisible: boolean) => {
|
|||||||
setSaveTime(flowDetail?.update_time);
|
setSaveTime(flowDetail?.update_time);
|
||||||
}, [flowDetail, setSaveTime]);
|
}, [flowDetail, setSaveTime]);
|
||||||
|
|
||||||
const saveAgent = useCallback(async () => {
|
// const saveAgent = useCallback(async () => {
|
||||||
if (!chatDrawerVisible) {
|
// if (!chatDrawerVisible) {
|
||||||
const ret = await saveGraph();
|
// const ret = await saveGraph();
|
||||||
setSaveTime(ret.data.update_time);
|
// setSaveTime(ret.data.update_time);
|
||||||
}
|
// }
|
||||||
}, [chatDrawerVisible, saveGraph, setSaveTime]);
|
// }, [chatDrawerVisible, saveGraph, setSaveTime]);
|
||||||
|
|
||||||
useDebounceEffect(
|
useDebounceEffect(
|
||||||
() => {
|
() => {
|
||||||
|
|||||||
@ -11,6 +11,7 @@ export enum Step {
|
|||||||
|
|
||||||
export const useSwitchStep = (step: Step) => {
|
export const useSwitchStep = (step: Step) => {
|
||||||
const [_, setSearchParams] = useSearchParams();
|
const [_, setSearchParams] = useSearchParams();
|
||||||
|
console.log('🚀 ~ useSwitchStep ~ _:', _);
|
||||||
const switchStep = useCallback(() => {
|
const switchStep = useCallback(() => {
|
||||||
setSearchParams(new URLSearchParams({ step: step.toString() }));
|
setSearchParams(new URLSearchParams({ step: step.toString() }));
|
||||||
}, [setSearchParams, step]);
|
}, [setSearchParams, step]);
|
||||||
|
|||||||
@ -16,7 +16,7 @@ export const useGetSharedChatSearchParams = () => {
|
|||||||
const data = Object.fromEntries(
|
const data = Object.fromEntries(
|
||||||
searchParams
|
searchParams
|
||||||
.entries()
|
.entries()
|
||||||
.filter(([key, value]) => key.startsWith(data_prefix))
|
.filter(([key]) => key.startsWith(data_prefix))
|
||||||
.map(([key, value]) => [key.replace(data_prefix, ''), value]),
|
.map(([key, value]) => [key.replace(data_prefix, ''), value]),
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -116,8 +116,7 @@ const SearchSetting: React.FC<SearchSettingProps> = ({
|
|||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
}, [avatarFile]);
|
}, [avatarFile]);
|
||||||
const { list: datasetListOrigin, loading: datasetLoading } =
|
const { list: datasetListOrigin } = useFetchKnowledgeList();
|
||||||
useFetchKnowledgeList();
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const datasetListMap = datasetListOrigin.map((item: IKnowledge) => {
|
const datasetListMap = datasetListOrigin.map((item: IKnowledge) => {
|
||||||
|
|||||||
@ -30,7 +30,7 @@ type SearchFormValues = z.infer<typeof searchFormSchema>;
|
|||||||
export default function SearchList() {
|
export default function SearchList() {
|
||||||
// const { data } = useFetchFlowList();
|
// const { data } = useFetchFlowList();
|
||||||
const { t } = useTranslate('search');
|
const { t } = useTranslate('search');
|
||||||
const { isLoading, isError, createSearch } = useCreateSearch();
|
const { isLoading, createSearch } = useCreateSearch();
|
||||||
const {
|
const {
|
||||||
data: list,
|
data: list,
|
||||||
searchParams,
|
searchParams,
|
||||||
|
|||||||
@ -24,7 +24,7 @@ export const useSendQuestion = (kbIds: string[]) => {
|
|||||||
api.ask,
|
api.ask,
|
||||||
);
|
);
|
||||||
const { testChunk, loading } = useTestChunkRetrieval();
|
const { testChunk, loading } = useTestChunkRetrieval();
|
||||||
const { testChunkAll, loading: loadingAll } = useTestChunkAllRetrieval();
|
const { testChunkAll } = useTestChunkAllRetrieval();
|
||||||
const [sendingLoading, setSendingLoading] = useState(false);
|
const [sendingLoading, setSendingLoading] = useState(false);
|
||||||
const [currentAnswer, setCurrentAnswer] = useState({} as IAnswer);
|
const [currentAnswer, setCurrentAnswer] = useState({} as IAnswer);
|
||||||
const { fetchRelatedQuestions, data: relatedQuestions } =
|
const { fetchRelatedQuestions, data: relatedQuestions } =
|
||||||
@ -102,7 +102,14 @@ export const useSendQuestion = (kbIds: string[]) => {
|
|||||||
size,
|
size,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
[sendingLoading, searchStr, kbIds, testChunk, selectedDocumentIds],
|
[
|
||||||
|
searchStr,
|
||||||
|
sendingLoading,
|
||||||
|
testChunk,
|
||||||
|
kbIds,
|
||||||
|
selectedDocumentIds,
|
||||||
|
testChunkAll,
|
||||||
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import {
|
|||||||
PasswordIcon,
|
PasswordIcon,
|
||||||
ProfileIcon,
|
ProfileIcon,
|
||||||
TeamIcon,
|
TeamIcon,
|
||||||
} from '@/assets/icon/Icon';
|
} from '@/assets/icon/next-icon';
|
||||||
import { IconFont } from '@/components/icon-font';
|
import { IconFont } from '@/components/icon-font';
|
||||||
import { LLMFactory } from '@/constants/llm';
|
import { LLMFactory } from '@/constants/llm';
|
||||||
import { UserSettingRouteKey } from '@/constants/setting';
|
import { UserSettingRouteKey } from '@/constants/setting';
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { translationTable } from '@/locales/config';
|
import { translationTable } from '@/locales/config';
|
||||||
import TranslationTable from './TranslationTable';
|
import TranslationTable from './translation-table';
|
||||||
|
|
||||||
function UserSettingLocale() {
|
function UserSettingLocale() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -46,7 +46,7 @@ const AzureOpenAIModal = ({
|
|||||||
{ value: 'image2text', label: 'image2text' },
|
{ value: 'image2text', label: 'image2text' },
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
const getOptions = (factory: string) => {
|
const getOptions = () => {
|
||||||
return optionsMap.Default;
|
return optionsMap.Default;
|
||||||
};
|
};
|
||||||
const handleKeyDown = async (e: React.KeyboardEvent) => {
|
const handleKeyDown = async (e: React.KeyboardEvent) => {
|
||||||
@ -132,7 +132,7 @@ const AzureOpenAIModal = ({
|
|||||||
type: 'number',
|
type: 'number',
|
||||||
message: t('maxTokensInvalidMessage'),
|
message: t('maxTokensInvalidMessage'),
|
||||||
},
|
},
|
||||||
({ getFieldValue }) => ({
|
({}) => ({
|
||||||
validator(_, value) {
|
validator(_, value) {
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
return Promise.reject(new Error(t('maxTokensMinMessage')));
|
return Promise.reject(new Error(t('maxTokensMinMessage')));
|
||||||
|
|||||||
@ -121,7 +121,7 @@ const BedrockModal = ({
|
|||||||
type: 'number',
|
type: 'number',
|
||||||
message: t('maxTokensInvalidMessage'),
|
message: t('maxTokensInvalidMessage'),
|
||||||
},
|
},
|
||||||
({ getFieldValue }) => ({
|
({}) => ({
|
||||||
validator(_, value) {
|
validator(_, value) {
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
return Promise.reject(new Error(t('maxTokensMinMessage')));
|
return Promise.reject(new Error(t('maxTokensMinMessage')));
|
||||||
|
|||||||
@ -103,7 +103,7 @@ const FishAudioModal = ({
|
|||||||
type: 'number',
|
type: 'number',
|
||||||
message: t('maxTokensInvalidMessage'),
|
message: t('maxTokensInvalidMessage'),
|
||||||
},
|
},
|
||||||
({ getFieldValue }) => ({
|
({}) => ({
|
||||||
validator(_, value) {
|
validator(_, value) {
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
return Promise.reject(new Error(t('maxTokensMinMessage')));
|
return Promise.reject(new Error(t('maxTokensMinMessage')));
|
||||||
|
|||||||
@ -110,7 +110,7 @@ const GoogleModal = ({
|
|||||||
type: 'number',
|
type: 'number',
|
||||||
message: t('maxTokensInvalidMessage'),
|
message: t('maxTokensInvalidMessage'),
|
||||||
},
|
},
|
||||||
({ getFieldValue }) => ({
|
({}) => ({
|
||||||
validator(_, value) {
|
validator(_, value) {
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
return Promise.reject(new Error(t('maxTokensMinMessage')));
|
return Promise.reject(new Error(t('maxTokensMinMessage')));
|
||||||
|
|||||||
@ -114,7 +114,6 @@ export const useSubmitOllama = () => {
|
|||||||
const [initialValues, setInitialValues] = useState<
|
const [initialValues, setInitialValues] = useState<
|
||||||
Partial<IAddLlmRequestBody> | undefined
|
Partial<IAddLlmRequestBody> | undefined
|
||||||
>();
|
>();
|
||||||
const [originalModelName, setOriginalModelName] = useState<string>('');
|
|
||||||
const { addLlm, loading } = useAddLlm();
|
const { addLlm, loading } = useAddLlm();
|
||||||
const {
|
const {
|
||||||
visible: llmAddingVisible,
|
visible: llmAddingVisible,
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { useTranslate } from '@/hooks/common-hooks';
|
import { useTranslate } from '@/hooks/common-hooks';
|
||||||
import { IModalProps } from '@/interfaces/common';
|
import { IModalProps } from '@/interfaces/common';
|
||||||
import { IAddLlmRequestBody } from '@/interfaces/request/llm';
|
import { IAddLlmRequestBody } from '@/interfaces/request/llm';
|
||||||
import { Form, Input, Modal, Select } from 'antd';
|
import { Form, Input, Modal } from 'antd';
|
||||||
import omit from 'lodash/omit';
|
import omit from 'lodash/omit';
|
||||||
|
|
||||||
type FieldType = IAddLlmRequestBody & {
|
type FieldType = IAddLlmRequestBody & {
|
||||||
@ -10,8 +10,6 @@ type FieldType = IAddLlmRequestBody & {
|
|||||||
hunyuan_sk: string;
|
hunyuan_sk: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
const { Option } = Select;
|
|
||||||
|
|
||||||
const HunyuanModal = ({
|
const HunyuanModal = ({
|
||||||
visible,
|
visible,
|
||||||
hideModal,
|
hideModal,
|
||||||
|
|||||||
@ -34,7 +34,6 @@ import { CircleHelp } from 'lucide-react';
|
|||||||
import { useCallback, useMemo } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
import SettingTitle from '../components/setting-title';
|
import SettingTitle from '../components/setting-title';
|
||||||
import { isLocalLlmFactory } from '../utils';
|
import { isLocalLlmFactory } from '../utils';
|
||||||
import TencentCloudModal from './Tencent-modal';
|
|
||||||
import ApiKeyModal from './api-key-modal';
|
import ApiKeyModal from './api-key-modal';
|
||||||
import AzureOpenAIModal from './azure-openai-modal';
|
import AzureOpenAIModal from './azure-openai-modal';
|
||||||
import BedrockModal from './bedrock-modal';
|
import BedrockModal from './bedrock-modal';
|
||||||
@ -58,6 +57,7 @@ import {
|
|||||||
} from './hooks';
|
} from './hooks';
|
||||||
import HunyuanModal from './hunyuan-modal';
|
import HunyuanModal from './hunyuan-modal';
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
|
import TencentCloudModal from './next-tencent-modal';
|
||||||
import OllamaModal from './ollama-modal';
|
import OllamaModal from './ollama-modal';
|
||||||
import SparkModal from './spark-modal';
|
import SparkModal from './spark-modal';
|
||||||
import SystemModelSettingModal from './system-model-setting-modal';
|
import SystemModelSettingModal from './system-model-setting-modal';
|
||||||
|
|||||||
@ -140,7 +140,7 @@ const SparkModal = ({
|
|||||||
type: 'number',
|
type: 'number',
|
||||||
message: t('maxTokensInvalidMessage'),
|
message: t('maxTokensInvalidMessage'),
|
||||||
},
|
},
|
||||||
({ getFieldValue }) => ({
|
({}) => ({
|
||||||
validator(_, value) {
|
validator(_, value) {
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
return Promise.reject(new Error(t('maxTokensMinMessage')));
|
return Promise.reject(new Error(t('maxTokensMinMessage')));
|
||||||
|
|||||||
@ -113,7 +113,7 @@ const VolcEngineModal = ({
|
|||||||
type: 'number',
|
type: 'number',
|
||||||
message: t('maxTokensInvalidMessage'),
|
message: t('maxTokensInvalidMessage'),
|
||||||
},
|
},
|
||||||
({ getFieldValue }) => ({
|
({}) => ({
|
||||||
validator(_, value) {
|
validator(_, value) {
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
return Promise.reject(new Error(t('maxTokensMinMessage')));
|
return Promise.reject(new Error(t('maxTokensMinMessage')));
|
||||||
|
|||||||
@ -108,7 +108,7 @@ const YiyanModal = ({
|
|||||||
type: 'number',
|
type: 'number',
|
||||||
message: t('maxTokensInvalidMessage'),
|
message: t('maxTokensInvalidMessage'),
|
||||||
},
|
},
|
||||||
({ getFieldValue }) => ({
|
({}) => ({
|
||||||
validator(_, value) {
|
validator(_, value) {
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
return Promise.reject(new Error(t('maxTokensMinMessage')));
|
return Promise.reject(new Error(t('maxTokensMinMessage')));
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import { registerNextServer } from '@/utils/register-server';
|
|||||||
const {
|
const {
|
||||||
getDialog,
|
getDialog,
|
||||||
setDialog,
|
setDialog,
|
||||||
listDialog,
|
// listDialog,
|
||||||
removeDialog,
|
removeDialog,
|
||||||
getConversation,
|
getConversation,
|
||||||
getConversationSSE,
|
getConversationSSE,
|
||||||
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable guard-for-in */
|
||||||
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
||||||
import { isObject } from 'lodash';
|
import { isObject } from 'lodash';
|
||||||
import omit from 'lodash/omit';
|
import omit from 'lodash/omit';
|
||||||
|
|||||||
Reference in New Issue
Block a user