更新前端看板
This commit is contained in:
@@ -64,6 +64,27 @@ export const streamChat = async (data: any): Promise<any> => {
|
||||
}
|
||||
}
|
||||
|
||||
/** 真实流式对话 — 使用 fetch 调用后端 SSE 端点,返回 Response 供 ReadableStream 消费 */
|
||||
export const streamChatReal = (data: any): Promise<Response> => {
|
||||
const messages = data.messages || []
|
||||
if (!messages.length && data.user_question) {
|
||||
if (data.system_prompt) {
|
||||
messages.push({ role: 'system', content: data.system_prompt })
|
||||
}
|
||||
messages.push({ role: 'user', content: data.user_question })
|
||||
}
|
||||
return fetch('/modelTF/model-compare/stream-chat', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
messages,
|
||||
temperature: data.temperature ?? 0.7,
|
||||
top_p: data.top_p ?? 0.95,
|
||||
max_tokens: data.max_tokens ?? 2048,
|
||||
}),
|
||||
})
|
||||
}
|
||||
|
||||
/** 非流式对话(按端口代理) */
|
||||
export const chatWithPort = (data: any) => post('/model-compare/chat-with-port', data)
|
||||
|
||||
@@ -73,8 +94,8 @@ export const batchChat = (data: any) => post('/model-chat/batch', data)
|
||||
/** 本地 transformers 模型对话 */
|
||||
export const localChat = (data: any) => post('/model-chat/local/chat', data)
|
||||
|
||||
/** 预加载本地模型 */
|
||||
export const preloadLocalModel = (data: any) => post('/model-chat/local/preload', data)
|
||||
/** 预加载本地模型(模型加载耗时长,超时 5 分钟) */
|
||||
export const preloadLocalModel = (data: any) => post('/model-chat/local/preload', data, { timeout: 300000 })
|
||||
|
||||
/** 预加载已训练模型 */
|
||||
export const preloadTrainedModel = (data: any) => post('/model-chat/trained/preload', data)
|
||||
/** 预加载已训练模型(超时 5 分钟) */
|
||||
export const preloadTrainedModel = (data: any) => post('/model-chat/trained/preload', data, { timeout: 300000 })
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { get, post, put } from '../request'
|
||||
import { del, get, post, put } from '../request'
|
||||
|
||||
export interface ComputeNode {
|
||||
id: string
|
||||
@@ -95,6 +95,9 @@ export const createComputeNode = (data: ComputeNodePayload) =>
|
||||
export const updateComputeNode = (id: string, data: Partial<ComputeNode>) =>
|
||||
put<ComputeNode>(`/compute/nodes/${id}`, data)
|
||||
|
||||
export const deleteComputeNode = (id: string) =>
|
||||
del<{ deleted: string }>(`/compute/nodes/${id}`)
|
||||
|
||||
export const testComputeNode = (id: string) =>
|
||||
post<{ node_id: string; success: boolean; latency_ms: number; gpu_count: number; error?: string }>(`/compute/nodes/${id}/test-connection`)
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ export const uploadDatasetFiles = (datasetId: string | number, files: File[]) =>
|
||||
files.forEach((f) => formData.append('files', f))
|
||||
return post(`/dataset-manage/upload/${datasetId}`, formData, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
timeout: 120000,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user