Skip to content

Commit df65d3e

Browse files
committed
fix: kv cache support in builtin backend
1 parent 6969cb0 commit df65d3e

File tree

15 files changed

+124
-40
lines changed

15 files changed

+124
-40
lines changed

config/routes.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,6 @@ export default [
135135
defaultIcon: 'icon-gpu1',
136136
component: './resources/components/gpus'
137137
},
138-
{
139-
name: 'modelfiles',
140-
path: '/resources/modelfiles',
141-
key: 'modelfiles',
142-
icon: 'icon-files',
143-
selectedIcon: 'icon-files-filled',
144-
defaultIcon: 'icon-files',
145-
component: './resources/components/model-files'
146-
},
147138
{
148139
name: 'backendsList',
149140
path: '/resources/backends',
@@ -153,6 +144,15 @@ export default [
153144
defaultIcon: 'icon-backend',
154145
access: 'canSeeAdmin',
155146
component: './backends/index'
147+
},
148+
{
149+
name: 'modelfiles',
150+
path: '/resources/modelfiles',
151+
key: 'modelfiles',
152+
icon: 'icon-files',
153+
selectedIcon: 'icon-files-filled',
154+
defaultIcon: 'icon-files',
155+
component: './resources/components/model-files'
156156
}
157157
]
158158
},

src/atoms/models.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export const backendOptionsAtom = atom<
3030
label: string;
3131
default_backend_param: string[];
3232
default_version: string;
33+
isBuiltIn: boolean;
3334
versions: { label: string; value: string }[];
3435
}[]
3536
>([]);

src/components/seal-form/checkbox-field.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
import { QuestionCircleOutlined } from '@ant-design/icons';
2-
import { Checkbox, Tooltip } from 'antd';
2+
import { Checkbox, CheckboxProps, Tooltip } from 'antd';
33
import { CheckboxChangeEvent } from 'antd/es/checkbox';
44
import React from 'react';
55

6-
const CheckboxField: React.FC<{
7-
description?: React.ReactNode;
8-
label: React.ReactNode;
9-
checked?: boolean;
10-
onChange?: (e: CheckboxChangeEvent) => void;
11-
}> = ({ description, label, checked, onChange }) => {
6+
const CheckboxField: React.FC<
7+
{
8+
description?: React.ReactNode;
9+
label: React.ReactNode;
10+
checked?: boolean;
11+
onChange?: (e: CheckboxChangeEvent) => void;
12+
} & CheckboxProps
13+
> = ({ description, label, checked, onChange, ...rest }) => {
1214
return (
13-
<Checkbox className="p-l-6" checked={checked} onChange={onChange}>
15+
<Checkbox className="p-l-6" checked={checked} onChange={onChange} {...rest}>
1416
<Tooltip title={description || false}>
1517
<span style={{ color: 'var(--ant-color-text-tertiary)' }}>{label}</span>
1618
{!!description && (

src/locales/en-US/models.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ export default {
187187
'models.form.chunkSize': 'Size Of Cache Chunks',
188188
'models.form.maxCPUSize': 'Maximum CPU Cache Size (GiB)',
189189
'models.form.remoteURL': 'Remote Storage URL',
190+
'models.form.remoteURL.tips':
191+
'Refer to the <a href="https://docs.lmcache.ai/api_reference/configurations.html" target="_blank">configuration documentation</a> for details.',
190192
'models.form.runCommandPlaceholder':
191193
'e.g., vllm serve Qwen/Qwen2.5-1.5B-Instruct',
192194
'models.accessSettings.public': 'Public',
@@ -206,5 +208,9 @@ export default {
206208
'You can specify the exact number of GPUs per replica.',
207209
'models.mymodels.status.inactive': 'Stopped',
208210
'models.mymodels.status.degrade': 'Abnormal',
209-
'models.mymodels.status.active': 'Active'
211+
'models.mymodels.status.active': 'Active',
212+
'models.form.kvCache.tips':
213+
'Available only with built-in backends (vLLM / SGLang) — switch backend in <span class="bold-text">Advanced</span> to enable.',
214+
'models.form.kvCache.tips2':
215+
'KV cache is only supported when using built-in inference backends (vLLM or SGLang).'
210216
};

src/locales/ja-JP/models.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ export default {
184184
'models.form.chunkSize': 'Size Of Cache Chunks',
185185
'models.form.maxCPUSize': 'Maximum CPU Cache Size (GiB)',
186186
'models.form.remoteURL': 'Remote Storage URL',
187+
'models.form.remoteURL.tips':
188+
'Refer to the <a href="https://docs.lmcache.ai/api_reference/configurations.html" target="_blank">configuration documentation</a> for details.',
187189
'models.form.runCommandPlaceholder':
188190
'e.g., vllm serve Qwen/Qwen2.5-1.5B-Instruct',
189191
'models.accessSettings.public': 'Public',
@@ -203,7 +205,11 @@ export default {
203205
'You can specify the exact number of GPUs per replica.',
204206
'models.mymodels.status.inactive': 'Stopped',
205207
'models.mymodels.status.degrade': 'Abnormal',
206-
'models.mymodels.status.active': 'Active'
208+
'models.mymodels.status.active': 'Active',
209+
'models.form.kvCache.tips':
210+
'Available only with built-in backends (vLLM / SGLang) — switch backend in <span class="bold-text">Advanced</span> to enable.',
211+
'models.form.kvCache.tips2':
212+
'KV cache is only supported when using built-in inference backends (vLLM or SGLang).'
207213
};
208214

209215
// ========== To-Do: Translate Keys (Remove After Translation) ==========
@@ -247,5 +253,7 @@ export default {
247253
// 39. 'models.mymodels.status.inactive': 'Stopped',
248254
// 41. 'models.mymodels.status.degrade': 'Abnormal',
249255
// 42. 'models.mymodels.status.active': 'Active'
250-
256+
// 43. 'models.form.remoteURL.tips': 'Refer to the <a href="https://docs.lmcache.ai/api_reference/configurations.html" target="_blank">configuration documentation</a> for details.',
257+
// 44. 'models.form.kvCache.tips': 'Available only with built-in backends (vLLM / SGLang) — switch backend in <span class="bold-text">Advanced</span> to enable.'
258+
// 45. 'models.form.kvCache.tips2': 'KV cache is only supported when using built-in inference backends (vLLM or SGLang).'
251259
// ========== End of To-Do List ==========

src/locales/ru-RU/models.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ export default {
187187
'models.form.chunkSize': 'Размер чанков кэша',
188188
'models.form.maxCPUSize': 'Максимальный размер CPU кэша (ГиБ)',
189189
'models.form.remoteURL': 'URL удаленного хранилища',
190+
'models.form.remoteURL.tips':
191+
'Refer to the <a href="https://docs.lmcache.ai/api_reference/configurations.html" target="_blank">configuration documentation</a> for details.',
190192
'models.form.runCommandPlaceholder':
191193
'напр., vllm serve Qwen/Qwen2.5-1.5B-Instruct',
192194
'models.accessSettings.public': 'Публичный',
@@ -206,11 +208,18 @@ export default {
206208
'Вы можете указать точное количество GPU на реплику.',
207209
'models.mymodels.status.inactive': 'Stopped',
208210
'models.mymodels.status.degrade': 'Abnormal',
209-
'models.mymodels.status.active': 'Active'
211+
'models.mymodels.status.active': 'Active',
212+
'models.form.kvCache.tips':
213+
'Available only with built-in backends (vLLM / SGLang) — switch backend in <span class="bold-text">Advanced</span> to enable.',
214+
'models.form.kvCache.tips2':
215+
'KV cache is only supported when using built-in inference backends (vLLM or SGLang).'
210216
};
211217

212218
// ========== To-Do: Translate Keys (Remove After Translation) ==========
213219
// 1. 'models.mymodels.status.inactive': 'Stopped',
214220
// 3. 'models.mymodels.status.degrade': 'Abnormal',
215221
// 4. 'models.mymodels.status.active': 'Active'
222+
// 5. 'models.form.remoteURL.tips': 'Refer to the <a href="https://docs.lmcache.ai/api_reference/configurations.html" target="_blank">configuration documentation</a> for details.',
223+
// 6. 'models.form.kvCache.tips': 'Available only with built-in backends (vLLM / SGLang) — switch backend in <span class="bold-text">Advanced</span> to enable.'
224+
// 7. 'models.form.kvCache.tips2': 'KV cache is only supported when using built-in inference backends (vLLM or SGLang).';
216225
// ========== End of To-Do List ==========

src/locales/zh-CN/models.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ export default {
176176
'models.form.chunkSize': '缓存分块大小',
177177
'models.form.maxCPUSize': 'CPU 缓存最大占用 (GiB)',
178178
'models.form.remoteURL': '远程存储地址',
179+
'models.form.remoteURL.tips':
180+
'参考 <a href="https://docs.lmcache.ai/api_reference/configurations.html" target="_blank">配置文档</a> 配置',
179181
'models.form.runCommandPlaceholder':
180182
'例如,vllm serve Qwen/Qwen2.5-1.5B-Instruct',
181183
'models.accessSettings.public': '公开',
@@ -194,5 +196,9 @@ export default {
194196
'models.form.gpusAllocationType.custom.tips': '您可以指定每个副本的 GPU 数量',
195197
'models.mymodels.status.inactive': '已停止',
196198
'models.mymodels.status.degrade': '异常',
197-
'models.mymodels.status.active': '可用'
199+
'models.mymodels.status.active': '可用',
200+
'models.form.kvCache.tips':
201+
'仅在内置后端(vLLM / SGLang)可用 —— 请在<span class="bold-text">高级</span>配置中切换后端以启用。',
202+
'models.form.kvCache.tips2':
203+
'仅在使用内置推理后端(vLLM 或 SGLang)时支持 KV 缓存。'
198204
};

src/pages/backends/components/import-yaml.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const ImportYAML: React.FC<ImportYAMLProps> = forwardRef(
101101
const renderHeader = () => {
102102
return (
103103
<Header>
104-
<span className="title">YAML Editor</span>
104+
<span className="title">YAML</span>
105105
<Upload
106106
name="file"
107107
multiple={false}
@@ -110,7 +110,7 @@ const ImportYAML: React.FC<ImportYAMLProps> = forwardRef(
110110
accept=".yaml,.yml,text/yaml,application/x-yaml"
111111
>
112112
<Button icon={<ImportOutlined />} type="text" size="small">
113-
Import
113+
{intl.formatMessage({ id: 'common.button.import' })}
114114
</Button>
115115
</Upload>
116116
</Header>

src/pages/backends/config/index.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import MindIELogo from '@/assets/logo/ascend.png';
22
import SGLangLogo from '@/assets/logo/sglang.png';
33
import vLLMLogo from '@/assets/logo/vllm.png';
44
import icons from '@/components/icon-font/icons';
5+
import { backendOptionsMap } from '@/pages/llmodels/config/backend-parameters';
56
import jsYaml from 'js-yaml';
67
import { trim } from 'lodash';
78

@@ -16,18 +17,11 @@ const SealYamlType = new jsYaml.Type('!seal', {
1617

1718
const SEAL_SCHEMA = jsYaml.DEFAULT_SCHEMA.extend([SealYamlType]);
1819

19-
export const builtInBackends = {
20-
SGLang: 'SGLang',
21-
vLLM: 'vLLM',
22-
MindIE: 'MindIE',
23-
VoxBox: 'voxbox'
24-
};
25-
2620
export const builtInBackendLogos: Record<string, string> = {
27-
[builtInBackends.SGLang]: SGLangLogo,
28-
[builtInBackends.vLLM]: vLLMLogo,
29-
[builtInBackends.MindIE]: MindIELogo,
30-
[builtInBackends.VoxBox]: ''
21+
[backendOptionsMap.SGLang]: SGLangLogo,
22+
[backendOptionsMap.vllm]: vLLMLogo,
23+
[backendOptionsMap.ascendMindie]: MindIELogo,
24+
[backendOptionsMap.voxBox]: ''
3125
};
3226

3327
export const backendActions = [

src/pages/backends/config/schema/update-builtin.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"version_configs": {
2424
"type": "object",
2525
"patternProperties": {
26-
"^[a-zA-Z0-9._-]+-custom$": {
26+
"^[a-zA-Z0-9._-]+$": {
2727
"type": "object",
2828
"properties": {
2929
"image_name": {
@@ -44,7 +44,7 @@
4444
}
4545
},
4646
"additionalProperties": false,
47-
"description": "multiple backend versions ending with -custom"
47+
"description": "multiple backend versions"
4848
}
4949
},
5050
"required": ["version_configs"],

0 commit comments

Comments
 (0)