MCPcopy Create free account
hub / github.com/AsyncFuncAI/deepwiki-open / get_cached_wiki

Function get_cached_wiki

api/api.py:462–484  ·  view source on GitHub ↗

Retrieves cached wiki data (structure and generated pages) for a repository.

(
    owner: str = Query(..., description="Repository owner"),
    repo: str = Query(..., description="Repository name"),
    repo_type: str = Query(..., description="Repository type (e.g., github, gitlab)"),
    language: str = Query(..., description="Language of the wiki content")
)

Source from the content-addressed store, hash-verified

460
461@app.get("/api/wiki_cache", response_model=Optional[WikiCacheData])
462async def get_cached_wiki(
463 owner: str = Query(..., description="Repository owner"),
464 repo: str = Query(..., description="Repository name"),
465 repo_type: str = Query(..., description="Repository type (e.g., github, gitlab)"),
466 language: str = Query(..., description="Language of the wiki content")
467):
468 """
469 Retrieves cached wiki data (structure and generated pages) for a repository.
470 """
471 # Language validation
472 supported_langs = configs["lang_config"]["supported_languages"]
473 if not supported_langs.__contains__(language):
474 language = configs["lang_config"]["default"]
475
476 logger.info(f"Attempting to retrieve wiki cache for {owner}/{repo} ({repo_type}), lang: {language}")
477 cached_data = await read_wiki_cache(owner, repo, repo_type, language)
478 if cached_data:
479 return cached_data
480 else:
481 # Return 200 with null body if not found, as frontend expects this behavior
482 # Or, raise HTTPException(status_code=404, detail="Wiki cache not found") if preferred
483 logger.info(f"Wiki cache not found for {owner}/{repo} ({repo_type}), lang: {language}")
484 return None
485
486@app.post("/api/wiki_cache")
487async def store_wiki_cache(request_data: WikiCacheRequest):

Callers

nothing calls this directly

Calls 1

read_wiki_cacheFunction · 0.85

Tested by

no test coverage detected