fix(audit): fallback the baseUrl properly using || to avoid relative POSTs on empty string
This commit is contained in:
@@ -161,7 +161,7 @@ export default function AuditPanel() {
|
||||
<Input
|
||||
value={config.baseUrl ?? ''}
|
||||
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>
|
||||
|
||||
@@ -114,7 +114,7 @@ async function callMinimax(
|
||||
onProgress?: (msg: string) => void,
|
||||
): Promise<string> {
|
||||
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 = {
|
||||
model: config.model,
|
||||
messages: [
|
||||
@@ -146,7 +146,7 @@ async function callOpenRouter(
|
||||
onProgress?: (msg: string) => void,
|
||||
): Promise<string> {
|
||||
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 = {
|
||||
model: config.model,
|
||||
messages: [
|
||||
@@ -183,7 +183,7 @@ async function callOllama(
|
||||
onProgress?: (msg: string) => void,
|
||||
): Promise<string> {
|
||||
onProgress?.('Enviando para Ollama (local)...');
|
||||
const baseUrl = config.baseUrl ?? 'http://localhost:11434';
|
||||
const baseUrl = config.baseUrl || 'http://localhost:11434';
|
||||
const body = {
|
||||
model: config.model,
|
||||
messages: [
|
||||
|
||||
Reference in New Issue
Block a user