恢复GE版本为0.18,生成SNIPPET后自动生成rag_text流程
This commit is contained in:
37
app/main.py
37
app/main.py
@ -24,6 +24,8 @@ from app.models import (
|
||||
LLMResponse,
|
||||
TableProfilingJobAck,
|
||||
TableProfilingJobRequest,
|
||||
TableSnippetRagIngestRequest,
|
||||
TableSnippetRagIngestResponse,
|
||||
TableSnippetUpsertRequest,
|
||||
TableSnippetUpsertResponse,
|
||||
)
|
||||
@ -252,6 +254,7 @@ def create_app() -> FastAPI:
|
||||
)
|
||||
raise HTTPException(status_code=500, detail=str(exc)) from exc
|
||||
else:
|
||||
# After snippet_alias is stored, automatically trigger RAG ingest when configured.
|
||||
if (
|
||||
payload.action_type == ActionType.SNIPPET_ALIAS
|
||||
and payload.status == ActionStatus.SUCCESS
|
||||
@ -267,14 +270,46 @@ def create_app() -> FastAPI:
|
||||
)
|
||||
except Exception:
|
||||
logger.exception(
|
||||
"Failed to ingest snippet RAG artifacts",
|
||||
"Failed to ingest snippet RAG artifacts after snippet_alias upsert",
|
||||
extra={
|
||||
"table_id": payload.table_id,
|
||||
"version_ts": payload.version_ts,
|
||||
"workspace_id": payload.rag_workspace_id,
|
||||
},
|
||||
)
|
||||
|
||||
return response
|
||||
|
||||
@application.post(
|
||||
"/v1/table/snippet/rag_ingest",
|
||||
response_model=TableSnippetRagIngestResponse,
|
||||
summary="Merge snippet+alias results from action_results and ingest into RAG.",
|
||||
)
|
||||
async def ingest_snippet_rag(
|
||||
payload: TableSnippetRagIngestRequest,
|
||||
client: httpx.AsyncClient = Depends(get_http_client),
|
||||
) -> TableSnippetRagIngestResponse:
|
||||
try:
|
||||
rag_item_ids = await ingest_snippet_rag_from_db(
|
||||
table_id=payload.table_id,
|
||||
version_ts=payload.version_ts,
|
||||
workspace_id=payload.workspace_id,
|
||||
rag_item_type=payload.rag_item_type or "SNIPPET",
|
||||
client=client,
|
||||
)
|
||||
except Exception as exc:
|
||||
logger.exception(
|
||||
"Failed to ingest snippet RAG artifacts",
|
||||
extra={
|
||||
"table_id": payload.table_id,
|
||||
"version_ts": payload.version_ts,
|
||||
"workspace_id": payload.workspace_id,
|
||||
},
|
||||
)
|
||||
raise HTTPException(status_code=500, detail=str(exc)) from exc
|
||||
|
||||
return TableSnippetRagIngestResponse(rag_item_ids=rag_item_ids)
|
||||
|
||||
@application.post("/__mock__/import-callback")
|
||||
async def mock_import_callback(payload: dict[str, Any]) -> dict[str, str]:
|
||||
logger.info("Received import analysis callback: %s", payload)
|
||||
|
||||
Reference in New Issue
Block a user