mirror of
https://github.com/zylon-ai/private-gpt.git
synced 2025-12-22 20:12:55 +01:00
Bug fixes on chat history filter plus removed system prompt
This commit is contained in:
parent
fb64e15802
commit
7dab3edebf
9 changed files with 21 additions and 21 deletions
|
|
@ -1,3 +1,4 @@
|
|||
from sqlalchemy.sql.expression import desc, asc
|
||||
from typing import Optional, List, Union, Dict, Any
|
||||
from fastapi import HTTPException, status
|
||||
from sqlalchemy.orm import Session
|
||||
|
|
@ -12,6 +13,16 @@ class CRUDChat(CRUDBase[ChatHistory, ChatHistoryCreate, ChatHistoryCreate]):
|
|||
def get_by_id(self, db: Session, *, id: uuid.UUID) -> Optional[ChatHistory]:
|
||||
return db.query(self.model).filter(ChatHistory.conversation_id == id).first()
|
||||
|
||||
def get_chat_history(
|
||||
self, db: Session, *, skip: int = 0, limit: int = 100
|
||||
) -> List[ChatHistory]:
|
||||
return (
|
||||
db.query(self.model)
|
||||
.order_by(desc(getattr(ChatHistory, 'created_at')))
|
||||
.offset(skip)
|
||||
.limit(limit)
|
||||
.all()
|
||||
)
|
||||
|
||||
class CRUDChatItem(CRUDBase[ChatItem, ChatItemCreate, ChatItemUpdate]):
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue