Skip to content

Commit 9bcc469

Browse files
authored
Merge pull request #122 from BUAA-SE-coders007/fix/121
[fix]: 修复path
2 parents aced245 + 6c66ccd commit 9bcc469

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

app/api/v1/endpoints/aichat.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from app.utils.readPDF import read_pdf
1212
from fastapi import HTTPException
1313
from app.curd.articleDB import update_article_intro
14-
from app.models.model import ArticleDB
14+
from app.models.model import ArticleDB, Article
1515

1616
router = APIRouter()
1717
redis_client = get_redis_client()
@@ -57,8 +57,13 @@ async def clear_notes(
5757
@router.get("/review", response_model=dict)
5858
async def review_notes(
5959
article_id: int,
60+
db : AsyncSession = Depends(get_db),
6061
):
61-
path = f"/lhcos-data/{article_id}.pdf"
62+
from sqlalchemy.future import select
63+
# 查找文献path
64+
result = await db.execute(select(Article).where(Article.id == article_id))
65+
article = result.scalars().first()
66+
path = article.url
6267
text = await read_pdf(path)
6368
text += "\n\n请根据以上内容生成文章综述。"
6469
async def ai_stream():

0 commit comments

Comments
 (0)