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:
parent
6678f81283
commit
a54d688867
|
|
@ -7,9 +7,10 @@ import { getPdfViewerUrl } from '../lib/api'
|
||||||
import { processCitations, processCitationsForSubq, extractCitedSources, highlightTerms } from '../utils/citationParser'
|
import { processCitations, processCitationsForSubq, extractCitedSources, highlightTerms } from '../utils/citationParser'
|
||||||
import { bulletizeMarkdown } 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 {
|
function getHighlightUrl(document_id: string, chunk_index: number, sub_question: string): string {
|
||||||
const base = 'http://localhost:8000/api/v1/v2'
|
return `${V2_BASE}/highlights?document_id=${encodeURIComponent(document_id)}&chunk_index=${chunk_index}&sub_question=${encodeURIComponent(sub_question)}`
|
||||||
return `${base}/highlights?document_id=${encodeURIComponent(document_id)}&chunk_index=${chunk_index}&sub_question=${encodeURIComponent(sub_question)}`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ResponsePanelProps {
|
interface ResponsePanelProps {
|
||||||
|
|
@ -220,8 +221,8 @@ function SubQuestionSections({
|
||||||
const startTime = performance.now()
|
const startTime = performance.now()
|
||||||
|
|
||||||
const url = historyId
|
const url = historyId
|
||||||
? `http://localhost:8000/api/v1/v2/highlights/batch?history_id=${historyId}`
|
? `${V2_BASE}/highlights/batch?history_id=${historyId}`
|
||||||
: 'http://localhost:8000/api/v1/v2/highlights/batch'
|
: `${V2_BASE}/highlights/batch`
|
||||||
fetch(url, {
|
fetch(url, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
|
|
||||||
|
|
@ -61,8 +61,8 @@ export function processCitationsForSubq(
|
||||||
|
|
||||||
function buildCitationUrl(source: SourceMetadata, highlightReady?: boolean): string | null {
|
function buildCitationUrl(source: SourceMetadata, highlightReady?: boolean): string | null {
|
||||||
if (highlightReady && source.document_id && source.sub_question_text) {
|
if (highlightReady && source.document_id && source.sub_question_text) {
|
||||||
const base = 'http://localhost:8000/api/v1/v2'
|
const v2Base = `${import.meta.env.VITE_API_BASE_URL ?? '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)}`
|
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) {
|
if (source.chunk_file_path) {
|
||||||
return getPdfViewerUrl(
|
return getPdfViewerUrl(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue