0.4.0 convex及界面修改

This commit is contained in:
liaibo
2026-02-01 08:47:40 +08:00
parent d1f055f51a
commit af92c4b149
636 changed files with 7522 additions and 1815 deletions
+14 -3
View File
@@ -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();