Merge WS v1 engine and web debug runtime-config integration
This commit is contained in:
@@ -41,6 +41,10 @@ const mapAssistant = (raw: AnyRecord): Assistant => ({
|
||||
configMode: readField(raw, ['configMode', 'config_mode'], 'platform') as 'platform' | 'dify' | 'fastgpt' | 'none',
|
||||
apiUrl: readField(raw, ['apiUrl', 'api_url'], ''),
|
||||
apiKey: readField(raw, ['apiKey', 'api_key'], ''),
|
||||
llmModelId: readField(raw, ['llmModelId', 'llm_model_id'], ''),
|
||||
asrModelId: readField(raw, ['asrModelId', 'asr_model_id'], ''),
|
||||
embeddingModelId: readField(raw, ['embeddingModelId', 'embedding_model_id'], ''),
|
||||
rerankModelId: readField(raw, ['rerankModelId', 'rerank_model_id'], ''),
|
||||
});
|
||||
|
||||
const mapVoice = (raw: AnyRecord): Voice => ({
|
||||
@@ -218,6 +222,10 @@ export const updateAssistant = async (id: string, data: Partial<Assistant>): Pro
|
||||
configMode: data.configMode,
|
||||
apiUrl: data.apiUrl,
|
||||
apiKey: data.apiKey,
|
||||
llmModelId: data.llmModelId,
|
||||
asrModelId: data.asrModelId,
|
||||
embeddingModelId: data.embeddingModelId,
|
||||
rerankModelId: data.rerankModelId,
|
||||
};
|
||||
const response = await apiRequest<AnyRecord>(`/assistants/${id}`, { method: 'PUT', body: payload });
|
||||
return mapAssistant(response);
|
||||
@@ -227,6 +235,21 @@ export const deleteAssistant = async (id: string): Promise<void> => {
|
||||
await apiRequest(`/assistants/${id}`, { method: 'DELETE' });
|
||||
};
|
||||
|
||||
export interface AssistantRuntimeConfigResponse {
|
||||
assistantId: string;
|
||||
sessionStartMetadata: Record<string, any>;
|
||||
sources?: {
|
||||
llmModelId?: string;
|
||||
asrModelId?: string;
|
||||
voiceId?: string;
|
||||
};
|
||||
warnings?: string[];
|
||||
}
|
||||
|
||||
export const fetchAssistantRuntimeConfig = async (assistantId: string): Promise<AssistantRuntimeConfigResponse> => {
|
||||
return apiRequest<AssistantRuntimeConfigResponse>(`/assistants/${assistantId}/runtime-config`);
|
||||
};
|
||||
|
||||
export const fetchVoices = async (): Promise<Voice[]> => {
|
||||
const response = await apiRequest<{ list?: AnyRecord[] } | AnyRecord[]>('/voices');
|
||||
const list = Array.isArray(response) ? response : (response.list || []);
|
||||
|
||||
Reference in New Issue
Block a user