Fix runtime config debug drawer
This commit is contained in:
@@ -1193,19 +1193,32 @@ export const DebugDrawer: React.FC<{
|
||||
const buildLocalResolvedRuntime = () => {
|
||||
const warnings: string[] = [];
|
||||
const services: Record<string, any> = {};
|
||||
const isExternalLlm = assistant.configMode === 'dify' || assistant.configMode === 'fastgpt';
|
||||
|
||||
if (assistant.llmModelId) {
|
||||
const llm = llmModels.find((item) => item.id === assistant.llmModelId);
|
||||
if (llm) {
|
||||
services.llm = {
|
||||
provider: 'openai',
|
||||
model: llm.modelName || llm.name,
|
||||
apiKey: llm.apiKey,
|
||||
baseUrl: llm.baseUrl,
|
||||
};
|
||||
} else {
|
||||
warnings.push(`LLM model not found in loaded list: ${assistant.llmModelId}`);
|
||||
}
|
||||
if (isExternalLlm) {
|
||||
services.llm = {
|
||||
provider: 'openai',
|
||||
model: '',
|
||||
apiKey: assistant.apiKey || '',
|
||||
baseUrl: assistant.apiUrl || '',
|
||||
};
|
||||
if (!assistant.apiUrl) warnings.push(`External LLM API URL is empty for mode: ${assistant.configMode}`);
|
||||
if (!assistant.apiKey) warnings.push(`External LLM API key is empty for mode: ${assistant.configMode}`);
|
||||
} else if (assistant.llmModelId) {
|
||||
const llm = llmModels.find((item) => item.id === assistant.llmModelId);
|
||||
if (llm) {
|
||||
services.llm = {
|
||||
provider: 'openai',
|
||||
model: llm.modelName || llm.name,
|
||||
apiKey: llm.apiKey,
|
||||
baseUrl: llm.baseUrl,
|
||||
};
|
||||
} else {
|
||||
warnings.push(`LLM model not found in loaded list: ${assistant.llmModelId}`);
|
||||
}
|
||||
} else {
|
||||
// Keep empty object to indicate engine should use default provider model.
|
||||
services.llm = {};
|
||||
}
|
||||
|
||||
if (assistant.asrModelId) {
|
||||
@@ -1245,9 +1258,10 @@ export const DebugDrawer: React.FC<{
|
||||
const localResolved = {
|
||||
assistantId: assistant.id,
|
||||
sources: {
|
||||
llmModelId: assistant.llmModelId || '',
|
||||
llmModelId: isExternalLlm ? '' : (assistant.llmModelId || ''),
|
||||
asrModelId: assistant.asrModelId || '',
|
||||
voiceId: assistant.voice || '',
|
||||
llmConfigMode: assistant.configMode || 'platform',
|
||||
},
|
||||
warnings,
|
||||
sessionStartMetadata: {
|
||||
|
||||
Reference in New Issue
Block a user