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
|
<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>
|
||||||
|
|||||||
@@ -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: [
|
||||||
|
|||||||
Reference in New Issue
Block a user