chore: format
This commit is contained in:
@@ -995,7 +995,10 @@ async def get_user_chats(user=Depends(get_verified_user)):
|
||||
|
||||
@router.get('/all/archived', response_model=list[ChatResponse])
|
||||
async def get_user_archived_chats(user=Depends(get_verified_user), db: AsyncSession = Depends(get_async_session)):
|
||||
return [ChatResponse.model_validate(chat, from_attributes=True) for chat in await Chats.get_archived_chats_by_user_id(user.id, db=db)]
|
||||
return [
|
||||
ChatResponse.model_validate(chat, from_attributes=True)
|
||||
for chat in await Chats.get_archived_chats_by_user_id(user.id, db=db)
|
||||
]
|
||||
|
||||
|
||||
############################
|
||||
@@ -1357,12 +1360,15 @@ async def update_chat_by_id(
|
||||
touch = 'history' in form_data.chat or 'messages' in form_data.chat
|
||||
chat = await Chats.update_chat_by_id(id, updated_chat, db=db, touch=touch)
|
||||
if form_data.variables is not None:
|
||||
chat = await Chats.update_chat_variables_by_id(
|
||||
id,
|
||||
form_data.variables,
|
||||
db=db,
|
||||
touch=False,
|
||||
) or chat
|
||||
chat = (
|
||||
await Chats.update_chat_variables_by_id(
|
||||
id,
|
||||
form_data.variables,
|
||||
db=db,
|
||||
touch=False,
|
||||
)
|
||||
or chat
|
||||
)
|
||||
|
||||
# Reconcile chat_message rows without inferring deletes from missing IDs.
|
||||
# Message deletion has its own endpoint below.
|
||||
|
||||
@@ -50,7 +50,7 @@ router = APIRouter()
|
||||
|
||||
|
||||
def add_chat_variables_schema(model_dict: dict) -> dict:
|
||||
system = ((model_dict.get('params') or {}).get('system') if isinstance(model_dict.get('params'), dict) else None)
|
||||
system = (model_dict.get('params') or {}).get('system') if isinstance(model_dict.get('params'), dict) else None
|
||||
schema = get_chat_variables_schema(system)
|
||||
if schema:
|
||||
model_dict.setdefault('meta', {})['chat_variables_schema'] = schema
|
||||
|
||||
Reference in New Issue
Block a user