Pass backendApiUrl to various API fetching functions for consistent endpoint usage

This commit is contained in:
2026-05-06 03:48:15 +02:00
parent 5e616dd302
commit 4408a01126

View File

@@ -229,7 +229,7 @@ export default function App() {
} }
try { try {
const data = await fetchModelCapabilities(nextModel) const data = await fetchModelCapabilities(backendApiUrl, nextModel)
if (!data?.supports_vision || modelRef.current !== nextModel) { if (!data?.supports_vision || modelRef.current !== nextModel) {
return false return false
} }
@@ -556,7 +556,7 @@ async function regenerateFromIndex(index, overrideUserText = null) {
if (hasPromptText && selectedLibrary?.states?.is_indexed) { if (hasPromptText && selectedLibrary?.states?.is_indexed) {
try { try {
const localContext = await fetchLocalLibraryContext(selectedLibrary.slug, promptText, requestController.signal) const localContext = await fetchLocalLibraryContext(backendApiUrl, selectedLibrary.slug, promptText, requestController.signal)
if (localContext.contextBlock) { if (localContext.contextBlock) {
contextBlocks.push(localContext.contextBlock) contextBlocks.push(localContext.contextBlock)
} }
@@ -956,7 +956,7 @@ async function regenerateFromIndex(index, overrideUserText = null) {
;(async () => { ;(async () => {
try { try {
const data = await fetchModelCapabilities(model, controller.signal) const data = await fetchModelCapabilities(backendApiUrl, model, controller.signal)
if (!cancelled) { if (!cancelled) {
setSelectedChatModelSupportsVision(Boolean(data?.supports_vision)) setSelectedChatModelSupportsVision(Boolean(data?.supports_vision))
} }
@@ -987,7 +987,7 @@ async function regenerateFromIndex(index, overrideUserText = null) {
;(async () => { ;(async () => {
try { try {
const data = await fetchModelCapabilities(visionModel, controller.signal) const data = await fetchModelCapabilities(backendApiUrl, visionModel, controller.signal)
if (!cancelled) { if (!cancelled) {
setSelectedVisionModelSupportsVision(Boolean(data?.supports_vision)) setSelectedVisionModelSupportsVision(Boolean(data?.supports_vision))
} }
@@ -1018,7 +1018,7 @@ async function regenerateFromIndex(index, overrideUserText = null) {
const timerId = window.setTimeout(() => { ;(async () => { const timerId = window.setTimeout(() => { ;(async () => {
let actionStarted = false let actionStarted = false
try { try {
let status = await fetchStartupOllamaStatus() let status = await fetchStartupOllamaStatus(backendApiUrl)
if (cancelled) return if (cancelled) return
syncAudioInputRuntimeFromStartupStatus(status) syncAudioInputRuntimeFromStartupStatus(status)
@@ -1052,7 +1052,7 @@ async function regenerateFromIndex(index, overrideUserText = null) {
} else { } else {
setStartupTaskMessage(`Downloading ${status.selected_embed_model} from Ollama. This can take a while on first install.`) setStartupTaskMessage(`Downloading ${status.selected_embed_model} from Ollama. This can take a while on first install.`)
} }
const prepared = await prepareStartupModels() const prepared = await prepareStartupModels(backendApiUrl)
if (cancelled) return if (cancelled) return
syncAudioInputRuntimeFromStartupStatus(prepared?.ollama || status) syncAudioInputRuntimeFromStartupStatus(prepared?.ollama || status)
} }
@@ -1404,7 +1404,7 @@ async function sendMessage() {
if (userMsg.content && selectedLibrary?.states?.is_indexed) { if (userMsg.content && selectedLibrary?.states?.is_indexed) {
try { try {
const localContext = await fetchLocalLibraryContext(selectedLibrary.slug, userMsg.content, requestController.signal) const localContext = await fetchLocalLibraryContext(backendApiUrl, selectedLibrary.slug, userMsg.content, requestController.signal)
if (localContext.contextBlock) { if (localContext.contextBlock) {
contextBlocks.push(localContext.contextBlock) contextBlocks.push(localContext.contextBlock)
} }