fix(audit): fallback the baseUrl properly using || to avoid relative POSTs on empty string

This commit is contained in:
2026-07-11 20:53:33 +00:00
parent 21c18afd02
commit 830091564c
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -161,7 +161,7 @@ export default function AuditPanel() {
<Input <Input
value={config.baseUrl ?? ''} value={config.baseUrl ?? ''}
onChange={(e) => setConfig((c) => ({ ...c, baseUrl: e.target.value || undefined }))} onChange={(e) => setConfig((c) => ({ ...c, baseUrl: e.target.value || undefined }))}
placeholder={config.provider === 'openrouter' ? 'https://openrouter.ai/api/v1 (padrão)' : config.provider === 'ollama' ? 'http://localhost:11434 (padrão)' : 'https://api.openai.com/v1'} placeholder={config.provider === 'openrouter' ? 'https://openrouter.ai/api/v1 (padrão)' : config.provider === 'minimax' ? 'https://api.minimax.chat/v1 (padrão)' : config.provider === 'ollama' ? 'http://localhost:11434 (padrão)' : 'https://api.openai.com/v1'}
/> />
</div> </div>
</div> </div>
+3 -3
View File
@@ -114,7 +114,7 @@ async function callMinimax(
onProgress?: (msg: string) => void, onProgress?: (msg: string) => void,
): Promise<string> { ): Promise<string> {
onProgress?.('Enviando para MiniMax...'); onProgress?.('Enviando para MiniMax...');
const url = config.baseUrl ?? 'https://api.minimax.chat/v1/chat/completions'; const url = config.baseUrl || 'https://api.minimax.chat/v1/chat/completions';
const body = { const body = {
model: config.model, model: config.model,
messages: [ messages: [
@@ -146,7 +146,7 @@ async function callOpenRouter(
onProgress?: (msg: string) => void, onProgress?: (msg: string) => void,
): Promise<string> { ): Promise<string> {
onProgress?.('Enviando para OpenRouter...'); onProgress?.('Enviando para OpenRouter...');
const url = config.baseUrl ?? 'https://openrouter.ai/api/v1/chat/completions'; const url = config.baseUrl || 'https://openrouter.ai/api/v1/chat/completions';
const body = { const body = {
model: config.model, model: config.model,
messages: [ messages: [
@@ -183,7 +183,7 @@ async function callOllama(
onProgress?: (msg: string) => void, onProgress?: (msg: string) => void,
): Promise<string> { ): Promise<string> {
onProgress?.('Enviando para Ollama (local)...'); onProgress?.('Enviando para Ollama (local)...');
const baseUrl = config.baseUrl ?? 'http://localhost:11434'; const baseUrl = config.baseUrl || 'http://localhost:11434';
const body = { const body = {
model: config.model, model: config.model,
messages: [ messages: [