fix: use VITE_API_BASE_URL for highlight endpoints instead of hardcoded localhost

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
Woody 2026-05-18 16:31:16 +08:00
parent 6678f81283
commit a54d688867
2 changed files with 7 additions and 6 deletions

View File

@ -7,9 +7,10 @@ import { getPdfViewerUrl } from '../lib/api'
import { processCitations, processCitationsForSubq, extractCitedSources, highlightTerms } from '../utils/citationParser'
import { bulletizeMarkdown } from '../utils/citationParser'
const V2_BASE = `${import.meta.env.VITE_API_BASE_URL ?? 'http://localhost:8000/api/v1'}/v2`
function getHighlightUrl(document_id: string, chunk_index: number, sub_question: string): string {
const base = 'http://localhost:8000/api/v1/v2'
return `${base}/highlights?document_id=${encodeURIComponent(document_id)}&chunk_index=${chunk_index}&sub_question=${encodeURIComponent(sub_question)}`
return `${V2_BASE}/highlights?document_id=${encodeURIComponent(document_id)}&chunk_index=${chunk_index}&sub_question=${encodeURIComponent(sub_question)}`
}
interface ResponsePanelProps {
@ -220,8 +221,8 @@ function SubQuestionSections({
const startTime = performance.now()
const url = historyId
? `http://localhost:8000/api/v1/v2/highlights/batch?history_id=${historyId}`
: 'http://localhost:8000/api/v1/v2/highlights/batch'
? `${V2_BASE}/highlights/batch?history_id=${historyId}`
: `${V2_BASE}/highlights/batch`
fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },

View File

@ -61,8 +61,8 @@ export function processCitationsForSubq(
function buildCitationUrl(source: SourceMetadata, highlightReady?: boolean): string | null {
if (highlightReady && source.document_id && source.sub_question_text) {
const base = 'http://localhost:8000/api/v1/v2'
return `${base}/highlights?document_id=${encodeURIComponent(source.document_id)}&chunk_index=${source.chunk_index}&sub_question=${encodeURIComponent(source.sub_question_text)}`
const v2Base = `${import.meta.env.VITE_API_BASE_URL ?? 'http://localhost:8000/api/v1'}/v2`
return `${v2Base}/highlights?document_id=${encodeURIComponent(source.document_id)}&chunk_index=${source.chunk_index}&sub_question=${encodeURIComponent(source.sub_question_text)}`
}
if (source.chunk_file_path) {
return getPdfViewerUrl(