Reviewed-on: #4 Co-authored-by: Ryan Chen <ryan@torrtle.co> Co-committed-by: Ryan Chen <ryan@torrtle.co>
18 lines
517 B
Python
18 lines
517 B
Python
from quart import Blueprint, jsonify
|
|
from .models import (
|
|
Conversation,
|
|
PydConversation,
|
|
)
|
|
|
|
conversation_blueprint = Blueprint(
|
|
"conversation_api", __name__, url_prefix="/api/conversation"
|
|
)
|
|
|
|
|
|
@conversation_blueprint.route("/<conversation_id>")
|
|
async def get_conversation(conversation_id: str):
|
|
conversation = await Conversation.get(id=conversation_id)
|
|
serialized_conversation = await PydConversation.from_tortoise_orm(conversation)
|
|
|
|
return jsonify(serialized_conversation.model_dump_json())
|