This commit is contained in:
parent
b1ce04b5d6
commit
b9a40d26ce
|
|
@ -91,6 +91,7 @@ export async function POST(req: Request) {
|
||||||
case "pdf":
|
case "pdf":
|
||||||
console.log("......[process] Processing PDF...")
|
console.log("......[process] Processing PDF...")
|
||||||
chunks = await processPdf(blob)
|
chunks = await processPdf(blob)
|
||||||
|
console.log("......[process] PDF Processed.")
|
||||||
break
|
break
|
||||||
case "txt":
|
case "txt":
|
||||||
chunks = await processTxt(blob)
|
chunks = await processTxt(blob)
|
||||||
|
|
@ -140,6 +141,7 @@ export async function POST(req: Request) {
|
||||||
|
|
||||||
embeddings = await Promise.all(embeddingPromises)
|
embeddings = await Promise.all(embeddingPromises)
|
||||||
} else if (embeddingsProvider === "bge-m3"){
|
} else if (embeddingsProvider === "bge-m3"){
|
||||||
|
console.log("......[embedding] enter bge-m3.")
|
||||||
// 示例:调用你自己的 BGE-M3 API 或本地函数
|
// 示例:调用你自己的 BGE-M3 API 或本地函数
|
||||||
const embeddingPromises = chunks.map(async chunk => {
|
const embeddingPromises = chunks.map(async chunk => {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ const MAX_RETRIES = 5
|
||||||
const RETRY_DELAY = 1000
|
const RETRY_DELAY = 1000
|
||||||
|
|
||||||
export function getRuntimeEnv(key: string): string | undefined {
|
export function getRuntimeEnv(key: string): string | undefined {
|
||||||
console.log("============>>Getting Supabase API URL.")
|
//console.log("============>>Getting Supabase API URL.")
|
||||||
|
|
||||||
if (typeof window !== "undefined") {
|
if (typeof window !== "undefined") {
|
||||||
if (!_env && typeof window.RUNTIME_ENV !== "undefined") {
|
if (!_env && typeof window.RUNTIME_ENV !== "undefined") {
|
||||||
|
|
@ -88,6 +88,6 @@ export function getRuntimeEnv(key: string): string | undefined {
|
||||||
|
|
||||||
// 服务端始终动态读取 process.env
|
// 服务端始终动态读取 process.env
|
||||||
const val = process.env[key]
|
const val = process.env[key]
|
||||||
console.log("[server-side] Falling back to process.env for key:", key, "value:", val)
|
//console.log("[server-side] Falling back to process.env for key:", key, "value:", val)
|
||||||
return val // 服务端直接返回 process.env 的值
|
return val // 服务端直接返回 process.env 的值
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue