Fix git sync and add repo browser with path selection
- Fix discover_files: rel_path always computed (was stuck at '.' at root), include_path_match now uses relative path, 'return' changed to 'continue' - Fix ingest_git_source: files were cloned but ingested from wrong path (docs/repo-id instead of data/repos/repo-id). Now stages filtered files into DOCS_PATH/library_id before calling ingest_library. - Add browse_repo_tree() for interactive repo exploration - Add POST /api/v1/sources/browse endpoint to backend - Add /sources/browse proxy route to webui - Rewrite sources.html: browse repo, expand/collapse tree, check paths to include, then save source and sync Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+14
-1
@@ -5,7 +5,7 @@ from pathlib import Path
|
||||
from typing import List, Optional
|
||||
|
||||
from fastapi import FastAPI, File, Form, Request, UploadFile
|
||||
from fastapi.responses import HTMLResponse, RedirectResponse
|
||||
from fastapi.responses import HTMLResponse, JSONResponse, RedirectResponse
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from fastapi.templating import Jinja2Templates
|
||||
|
||||
@@ -257,6 +257,19 @@ def parse_path_list(value: str) -> List[str]:
|
||||
return paths
|
||||
|
||||
|
||||
@app.post("/sources/browse")
|
||||
async def browse_source(repo_url: str = Form(...), branch: str = Form("main")):
|
||||
client = get_client()
|
||||
try:
|
||||
result = await client.post(
|
||||
"/api/v1/sources/browse",
|
||||
json={"repo_url": repo_url, "branch": branch},
|
||||
)
|
||||
return JSONResponse(content=result)
|
||||
except Exception as e:
|
||||
return JSONResponse(status_code=400, content={"success": False, "error": str(e)})
|
||||
|
||||
|
||||
@app.post("/sources/add")
|
||||
async def add_source(
|
||||
library_id: str = Form(...),
|
||||
|
||||
Reference in New Issue
Block a user