feat: add context length

This commit is contained in:
jialin
2026-01-06 17:21:32 +08:00
parent d8b3331648
commit 0f7a475ec9
23 changed files with 164 additions and 40 deletions
@@ -0,0 +1,29 @@
import { useState } from 'react';
import { queryModelContextLength } from '../apis';
export const useQueryContextLength = () => {
const [modelContextData, setModelContextData] = useState<{
native: number;
scaled: number;
}>({} as any);
const fetchContextLength = async (params: {
source: string;
model_scope_model_id?: string;
huggingface_repo_id?: string;
local_path?: string;
}) => {
try {
const res = await queryModelContextLength({
model: params
});
setModelContextData(res);
} catch (error) {
setModelContextData({} as any);
}
};
return {
modelContextData,
fetchContextLength
};
};