From 0f7a475ec91c630adfe07344e3382a324eeba26d Mon Sep 17 00:00:00 2001 From: jialin Date: Sun, 4 Jan 2026 16:34:34 +0800 Subject: [PATCH] feat: add context length --- package.json | 2 ++ pnpm-lock.yaml | 12 +++++--- src/components/seal-form/seal-slider.tsx | 6 ++-- src/components/seal-form/simple-select.tsx | 2 +- src/components/seal-form/wrapper/index.tsx | 7 ++++- src/components/seal-form/wrapper/slider.ts | 5 +++- src/config/theme/dark.ts | 7 ++--- src/config/theme/light.ts | 7 ++--- src/locales/en-US/models.ts | 3 +- src/locales/ja-JP/models.ts | 6 ++-- src/locales/ru-RU/models.ts | 8 ++--- src/locales/zh-CN/models.ts | 3 +- .../backends/components/backend-card.tsx | 21 +++++++++++-- src/pages/llmodels/apis/index.ts | 17 +++++++++++ .../llmodels/components/deploy-modal.tsx | 2 -- .../components/incompatiable-info.tsx | 2 +- .../llmodels/components/instance-item.tsx | 2 +- src/pages/llmodels/config/form-context.ts | 1 + src/pages/llmodels/config/index.ts | 3 +- src/pages/llmodels/forms/advance-config.tsx | 27 +++++++++++++---- src/pages/llmodels/forms/index.tsx | 30 ++++++++++++++++++- .../llmodels/hooks/use-models-columns.tsx | 2 +- .../services/use-query-context-length.ts | 29 ++++++++++++++++++ 23 files changed, 164 insertions(+), 40 deletions(-) create mode 100644 src/pages/llmodels/services/use-query-context-length.ts diff --git a/package.json b/package.json index 853215e0..e4e4538a 100644 --- a/package.json +++ b/package.json @@ -78,6 +78,7 @@ "remark-breaks": "^4.0.0", "remark-gfm": "^4.0.1", "remark-math": "^6.0.0", + "semver": "^7.7.3", "simplebar-react": "^3.2.6", "styled-components": "^6.1.15", "tinycolor2": "^1.6.0", @@ -88,6 +89,7 @@ "devDependencies": { "@types/react": "^18.3.1", "@types/react-dom": "^18.3.0", + "@types/semver": "^7.7.1", "@umijs/case-sensitive-paths-webpack-plugin": "^1.0.1", "@umijs/plugins": "^4.4.11", "babel-plugin-named-asset-import": "^0.3.8", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2eec9ffa..843c4d90 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -195,6 +195,9 @@ dependencies: remark-math: specifier: ^6.0.0 version: 6.0.0 + semver: + specifier: ^7.7.3 + version: 7.7.3 simplebar-react: specifier: ^3.2.6 version: 3.3.2(react@18.3.1) @@ -221,6 +224,9 @@ devDependencies: '@types/react-dom': specifier: ^18.3.0 version: 18.3.7(@types/react@18.3.27) + '@types/semver': + specifier: ^7.7.1 + version: 7.7.1 '@umijs/case-sensitive-paths-webpack-plugin': specifier: ^1.0.1 version: 1.0.1 @@ -4110,7 +4116,7 @@ packages: resolution: {integrity: sha512-hy8b7Y1J8OGe6LbAjj3xniQrj3v6lsivCcrmf4TzSgPzLkhIeKgc5IZnT7ReIqmEuodjfO8EYAuoFvIrHi/+jQ==, tarball: https://registry.npmjs.org/@types/history/-/history-5.0.0.tgz} deprecated: This is a stub types definition. history provides its own type definitions, so you do not need this installed. dependencies: - history: 4.10.1 + history: 5.3.0 /@types/hoist-non-react-statics@3.3.7(@types/react@18.3.27): resolution: {integrity: sha512-PQTyIulDkIDro8P+IHbKCsw7U2xxBYflVzW/FgWdCAePD9xGSidgA76/GeJ6lBKoblyhf9pBY763gbrN+1dI8g==, tarball: https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.7.tgz} @@ -4234,7 +4240,7 @@ packages: '@types/history': 4.7.11 '@types/react': 18.3.27 '@types/react-router': 5.1.20 - redux: 3.7.2 + redux: 4.2.1 /@types/react-router@5.1.20: resolution: {integrity: sha512-jGjmu/ZqS7FjSH6owMcD5qpq19+1RS9DeVRqfl1FeBMxTDQAGwlMWOcs52NDoXaNKyG3d1cYQFMs9rCrb88o9Q==, tarball: https://registry.npmjs.org/@types/react-router/-/react-router-5.1.20.tgz} @@ -4254,7 +4260,6 @@ packages: /@types/semver@7.7.1: resolution: {integrity: sha512-FmgJfu+MOcQ370SD0ev7EI8TlCAfKYU+B4m5T3yXc1CiRN94g/SZPtsCkk506aUDtlMnFZvasDwHHUcZUEaYuA==, tarball: https://registry.npmjs.org/@types/semver/-/semver-7.7.1.tgz} - dev: false /@types/stylis@4.2.5: resolution: {integrity: sha512-1Xve+NMN7FWjY14vLoY5tL3BVEQ/n42YLwaqJIPYhotZ9uBHt87VceMwWQpzmdEt2TNXIorIFG+YeCUUW7RInw==, tarball: https://registry.npmjs.org/@types/stylis/-/stylis-4.2.5.tgz} @@ -9400,7 +9405,6 @@ packages: resolution: {integrity: sha512-ZqaKwjjrAYUYfLG+htGaIIZ4nioX2L70ZUMIFysS3xvBsSG4x/n1V6TXV3N8ZYNuFGlDirFg32T7B6WOUPDYcQ==, tarball: https://registry.npmjs.org/history/-/history-5.3.0.tgz} dependencies: '@babel/runtime': 7.28.4 - dev: false /hmac-drbg@1.0.1: resolution: {integrity: sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==, tarball: https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz} diff --git a/src/components/seal-form/seal-slider.tsx b/src/components/seal-form/seal-slider.tsx index c605e6b0..99161f8c 100644 --- a/src/components/seal-form/seal-slider.tsx +++ b/src/components/seal-form/seal-slider.tsx @@ -48,7 +48,7 @@ const SealSlider: React.FC = (props) => { props.onChange?.(newValue); }; - const renderLabel = React.useMemo(() => { + const renderLabel = () => { return ( = (props) => { )} ); - }, [label, labelWidth, description, value, max, min, step, defaultValue]); + }; return ( diff --git a/src/components/seal-form/simple-select.tsx b/src/components/seal-form/simple-select.tsx index 55425b5f..5c9e73f4 100644 --- a/src/components/seal-form/simple-select.tsx +++ b/src/components/seal-form/simple-select.tsx @@ -175,7 +175,7 @@ const SimpleSelect: React.FC = return ( = ({ onClick={onClick} > {label && ( -