mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-05-01 05:00:13 +00:00
Add langfuse and update logger (#952)
Co-authored-by: bytecraftii <bytecraftii@users.noreply.github.com> Co-authored-by: Wendong-Fan <w3ndong.fan@gmail.com>
This commit is contained in:
parent
cf571b73a4
commit
49e148a2f9
63 changed files with 3095 additions and 2430 deletions
|
|
@ -21,17 +21,16 @@ from fastapi_babel import _
|
|||
from sqlmodel import Session, select, desc, case
|
||||
from app.component.auth import Auth, auth_must
|
||||
from app.component.database import session
|
||||
from utils import traceroot_wrapper as traceroot
|
||||
import logging
|
||||
from typing import Optional, Dict, List
|
||||
from collections import defaultdict
|
||||
|
||||
logger = traceroot.get_logger("server_chat_history")
|
||||
logger = logging.getLogger("server_chat_history")
|
||||
|
||||
router = APIRouter(prefix="/chat", tags=["Chat History"])
|
||||
|
||||
|
||||
@router.post("/history", name="save chat history", response_model=ChatHistoryOut)
|
||||
@traceroot.trace()
|
||||
def create_chat_history(data: ChatHistoryIn, session: Session = Depends(session), auth: Auth = Depends(auth_must)):
|
||||
"""Save new chat history."""
|
||||
user_id = auth.user.id
|
||||
|
|
@ -51,7 +50,6 @@ def create_chat_history(data: ChatHistoryIn, session: Session = Depends(session)
|
|||
|
||||
|
||||
@router.get("/histories", name="get chat history")
|
||||
@traceroot.trace()
|
||||
def list_chat_history(session: Session = Depends(session), auth: Auth = Depends(auth_must)) -> Page[ChatHistoryOut]:
|
||||
"""List chat histories for current user."""
|
||||
user_id = auth.user.id
|
||||
|
|
@ -75,7 +73,6 @@ def list_chat_history(session: Session = Depends(session), auth: Auth = Depends(
|
|||
|
||||
|
||||
@router.get("/histories/grouped", name="get grouped chat history")
|
||||
@traceroot.trace()
|
||||
def list_grouped_chat_history(
|
||||
include_tasks: Optional[bool] = Query(True, description="Whether to include individual tasks in groups"),
|
||||
session: Session = Depends(session),
|
||||
|
|
@ -177,7 +174,6 @@ def list_grouped_chat_history(
|
|||
|
||||
|
||||
@router.delete("/history/{history_id}", name="delete chat history")
|
||||
@traceroot.trace()
|
||||
def delete_chat_history(history_id: str, session: Session = Depends(session), auth: Auth = Depends(auth_must)):
|
||||
"""Delete chat history."""
|
||||
user_id = auth.user.id
|
||||
|
|
@ -203,7 +199,6 @@ def delete_chat_history(history_id: str, session: Session = Depends(session), au
|
|||
|
||||
|
||||
@router.put("/history/{history_id}", name="update chat history", response_model=ChatHistoryOut)
|
||||
@traceroot.trace()
|
||||
def update_chat_history(
|
||||
history_id: int, data: ChatHistoryUpdate, session: Session = Depends(session), auth: Auth = Depends(auth_must)
|
||||
):
|
||||
|
|
@ -232,7 +227,6 @@ def update_chat_history(
|
|||
|
||||
|
||||
@router.put("/project/{project_id}/name", name="update project name")
|
||||
@traceroot.trace()
|
||||
def update_project_name(
|
||||
project_id: str,
|
||||
new_name: str,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue