feat(rag): replace LiteParse flows with LightRAG provider
This commit is contained in:
@@ -17,14 +17,23 @@ use serde_json::{json, Value};
|
||||
use std::path::{Component, Path};
|
||||
|
||||
pub async fn search(
|
||||
State(state): State<AppState>,
|
||||
State(_state): State<AppState>,
|
||||
Extension(context): Extension<RequestContext>,
|
||||
Json(body): Json<EvidenceSearchRequest>,
|
||||
Json(_body): Json<EvidenceSearchRequest>,
|
||||
) -> Result<(StatusCode, HeaderMap, Json<Value>), WebError> {
|
||||
let response = search_payload(&state, &context, body).await?;
|
||||
let mut headers = HeaderMap::new();
|
||||
headers.insert("content-type", HeaderValue::from_static("application/json"));
|
||||
Ok((StatusCode::OK, headers, Json(response)))
|
||||
Ok((
|
||||
StatusCode::GONE,
|
||||
headers,
|
||||
Json(json!({
|
||||
"ok": false,
|
||||
"code": "mnote_evidence_search_retired",
|
||||
"message": "旧 LiteParse/evidence 搜索已退役;PDF、Office、图片 OCR 与资料索引统一走 /api/knowledge-rag/query",
|
||||
"requestId": context.trace.request_id,
|
||||
"traceId": context.trace.trace_id,
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
pub(crate) async fn search_payload(
|
||||
@@ -241,7 +250,7 @@ fn suggested_evidence_queries(query: &str) -> Vec<String> {
|
||||
suggestions
|
||||
}
|
||||
|
||||
fn citation_markdown_for_locator(locator: &EvidenceLocator) -> String {
|
||||
pub(crate) fn citation_markdown_for_locator(locator: &EvidenceLocator) -> String {
|
||||
let label = citation_label_for_locator(locator);
|
||||
let url = citation_url_for_locator(locator);
|
||||
format!(
|
||||
@@ -280,7 +289,7 @@ fn citation_label_for_locator(locator: &EvidenceLocator) -> String {
|
||||
parts.join(" · ")
|
||||
}
|
||||
|
||||
fn citation_url_for_locator(locator: &EvidenceLocator) -> String {
|
||||
pub(crate) fn citation_url_for_locator(locator: &EvidenceLocator) -> String {
|
||||
let owner_document_id = locator.owner_document_id.trim();
|
||||
let mut url = if owner_document_id.is_empty() {
|
||||
let existing = locator.open_action.url.trim();
|
||||
|
||||
Reference in New Issue
Block a user