Label maker add
This commit is contained in:
@@ -7,7 +7,7 @@ from typing import List, Dict, Any
|
||||
import uuid
|
||||
|
||||
from . import storage
|
||||
from .council import run_full_council
|
||||
from .council import run_full_council, generate_conversation_title
|
||||
|
||||
app = FastAPI(title="LLM Council API")
|
||||
|
||||
@@ -35,6 +35,7 @@ class ConversationMetadata(BaseModel):
|
||||
"""Conversation metadata for list view."""
|
||||
id: str
|
||||
created_at: str
|
||||
title: str
|
||||
message_count: int
|
||||
|
||||
|
||||
@@ -42,6 +43,7 @@ class Conversation(BaseModel):
|
||||
"""Full conversation with all messages."""
|
||||
id: str
|
||||
created_at: str
|
||||
title: str
|
||||
messages: List[Dict[str, Any]]
|
||||
|
||||
|
||||
@@ -85,9 +87,17 @@ async def send_message(conversation_id: str, request: SendMessageRequest):
|
||||
if conversation is None:
|
||||
raise HTTPException(status_code=404, detail="Conversation not found")
|
||||
|
||||
# Check if this is the first message
|
||||
is_first_message = len(conversation["messages"]) == 0
|
||||
|
||||
# Add user message
|
||||
storage.add_user_message(conversation_id, request.content)
|
||||
|
||||
# If this is the first message, generate a title
|
||||
if is_first_message:
|
||||
title = await generate_conversation_title(request.content)
|
||||
storage.update_conversation_title(conversation_id, title)
|
||||
|
||||
# Run the 3-stage council process
|
||||
stage1_results, stage2_results, stage3_result, metadata = await run_full_council(
|
||||
request.content
|
||||
|
||||
Reference in New Issue
Block a user