This commit is contained in:
parent
f0e6baa352
commit
936d7c298d
|
|
@ -22,6 +22,7 @@ import {
|
||||||
import React from "react"
|
import React from "react"
|
||||||
import { toast } from "sonner"
|
import { toast } from "sonner"
|
||||||
import { v4 as uuidv4 } from "uuid"
|
import { v4 as uuidv4 } from "uuid"
|
||||||
|
import { getRuntimeEnv } from "@/lib/ipconfig"
|
||||||
|
|
||||||
export const validateChatSettings = (
|
export const validateChatSettings = (
|
||||||
chatSettings: ChatSettings | null,
|
chatSettings: ChatSettings | null,
|
||||||
|
|
@ -58,7 +59,19 @@ export const handleRetrieval = async (
|
||||||
embeddingsProvider: "openai" | "local" | "bge-m3",
|
embeddingsProvider: "openai" | "local" | "bge-m3",
|
||||||
sourceCount: number
|
sourceCount: number
|
||||||
) => {
|
) => {
|
||||||
const response = await fetch("/api/retrieval/retrieve", {
|
|
||||||
|
// 在 handleRetrieval 或者你发这条请求的地方:
|
||||||
|
const supaUrl = getRuntimeEnv("SUPABASE_URL") ?? "http://localhost:8000"
|
||||||
|
// 构造 URL 对象并把端口改成 8001
|
||||||
|
const urlObj = new URL(supaUrl)
|
||||||
|
urlObj.port = "8001"
|
||||||
|
// 拼出检索接口的完整地址
|
||||||
|
const retrieveUrl = `${urlObj.origin}/api/retrieval/retrieve`
|
||||||
|
|
||||||
|
console.debug("[handleRetrieval] retrieveUrl =", retrieveUrl)
|
||||||
|
|
||||||
|
// const response = await fetch("/api/retrieval/retrieve", {
|
||||||
|
const response = await fetch(retrieveUrl, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
userInput,
|
userInput,
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,7 @@ export const useChatHandler = () => {
|
||||||
embeddingsProvider: selectedAssistant.embeddings_provider as
|
embeddingsProvider: selectedAssistant.embeddings_provider as
|
||||||
| "openai"
|
| "openai"
|
||||||
| "local"
|
| "local"
|
||||||
|
| "bge-m3"
|
||||||
})
|
})
|
||||||
|
|
||||||
let allFiles = []
|
let allFiles = []
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue