0.4.0 convex及界面修改
This commit is contained in:
@@ -3,10 +3,21 @@ type IngestTextArgs = {
|
||||
text: string;
|
||||
};
|
||||
|
||||
export async function lightragIngestText(args: IngestTextArgs): Promise<{ trackId: string | null }> {
|
||||
type IngestTextResult = {
|
||||
trackId: string | null;
|
||||
skipped?: boolean;
|
||||
reason?: string;
|
||||
};
|
||||
|
||||
export function isLightRagEnabled(): boolean {
|
||||
return Boolean((process.env.LIGHTRAG_URL || "").trim());
|
||||
}
|
||||
|
||||
export async function lightragIngestText(args: IngestTextArgs): Promise<IngestTextResult> {
|
||||
const baseUrl = (process.env.LIGHTRAG_URL || "").trim().replace(/\/+$/, "");
|
||||
if (!baseUrl) {
|
||||
throw new Error("缺少环境变量:LIGHTRAG_URL");
|
||||
// 说明:LightRAG 未配置时不应让任务系统持续报错;直接降级为“跳过入库”。
|
||||
return { trackId: null, skipped: true, reason: "missing_env_LIGHTRAG_URL" };
|
||||
}
|
||||
|
||||
const fileSource = String(args.fileSource ?? "").trim();
|
||||
@@ -16,7 +27,7 @@ export async function lightragIngestText(args: IngestTextArgs): Promise<{ trackI
|
||||
|
||||
const text = String(args.text ?? "");
|
||||
if (!text.trim()) {
|
||||
return { trackId: null };
|
||||
return { trackId: null, skipped: true, reason: "empty_text" };
|
||||
}
|
||||
|
||||
const apiKey = (process.env.LIGHTRAG_API_KEY || "").trim();
|
||||
|
||||
Reference in New Issue
Block a user