|
|
|
@ -14,6 +14,7 @@ from starlette.responses import StreamingResponse
|
|
|
|
|
from starlette.staticfiles import StaticFiles
|
|
|
|
|
|
|
|
|
|
from Util.LightRagUtil import *
|
|
|
|
|
from Util.PostgreSQLUtil import init_postgres_pool
|
|
|
|
|
|
|
|
|
|
# 在程序开始时添加以下配置
|
|
|
|
|
logging.basicConfig(
|
|
|
|
@ -144,8 +145,8 @@ async def save_to_word(request: fastapi.Request):
|
|
|
|
|
@app.get("/api/tree-data")
|
|
|
|
|
async def get_tree_data():
|
|
|
|
|
try:
|
|
|
|
|
mysql_pool = await init_mysql_pool()
|
|
|
|
|
async with mysql_pool.acquire() as conn:
|
|
|
|
|
pg_pool = await init_postgres_pool()
|
|
|
|
|
async with pg_pool.acquire() as conn:
|
|
|
|
|
await conn.ping()
|
|
|
|
|
async with conn.cursor() as cur:
|
|
|
|
|
await cur.execute("""
|
|
|
|
@ -212,8 +213,8 @@ async def update_knowledge(request: fastapi.Request):
|
|
|
|
|
if not node_id:
|
|
|
|
|
raise ValueError("Missing node_id")
|
|
|
|
|
|
|
|
|
|
mysql_pool = await init_mysql_pool()
|
|
|
|
|
async with mysql_pool.acquire() as conn:
|
|
|
|
|
pg_pool = await init_postgres_pool()
|
|
|
|
|
async with pg_pool.acquire() as conn:
|
|
|
|
|
await conn.ping()
|
|
|
|
|
async with conn.cursor() as cur:
|
|
|
|
|
if update_type == 'prerequisite':
|
|
|
|
|