diff --git a/backend/app/ai_manager.py b/backend/app/ai_manager.py index 9f83960..ac6b2be 100644 --- a/backend/app/ai_manager.py +++ b/backend/app/ai_manager.py @@ -11,12 +11,13 @@ client = OpenAI(api_key=os.getenv("OPENAI_API_KEY")) -def generate_initial_prompt(meeting_description: str, username: str) -> str: +def generate_initial_prompt(meeting_title: str, meeting_description: str, username: str) -> str: """ Generate the initial system message for the meeting preparation. """ return f"""You are an assistant that prepares the following meeting: -{meeting_description} +Title: {meeting_title} +Description: {meeting_description} Help user {username} clarify their personal agenda for the meeting. Update the agenda and refine it, while taking to the user. Make sure the agenda is concrete and specific. Ask the user questions to clarify their agenda and make it concrete, so that the meeting can be more productive. diff --git a/backend/app/routers/meetings.py b/backend/app/routers/meetings.py index 6945f7e..6a6ea84 100644 --- a/backend/app/routers/meetings.py +++ b/backend/app/routers/meetings.py @@ -10,6 +10,10 @@ from ..models import Conversation, Meeting, ChatMessage, MeetingAgenda from ..util.openai import init_conversation, generate_response +import logging + +logger = logging.getLogger(__name__) + router = APIRouter() # Meeting CRUD operations @@ -29,9 +33,16 @@ def create_new_conversation(db: Session, meeting_id: int, user_id: int): db_conversation = get_conversation(db, meeting_id=meeting_id, user_id=user_id) - prompt = generate_initial_prompt(db_conversation.meeting.description, db_conversation.user.username) + logger.debug(f"Generating initial prompt for meeting_id: {meeting_id}, user_id: {user_id}") + logger.debug(f"Meeting description: {db_conversation.meeting.description}") + logger.debug(f"User username: {db_conversation.user.username}") + + prompt = generate_initial_prompt(db_conversation.meeting.title, db_conversation.meeting.description, db_conversation.user.username) + logger.debug(f"Generated initial prompt: {prompt}") + db_conversation.system_prompt = prompt initial_message = process_user_message(prompt, []) + logger.debug(f"Initial AI response: {initial_message['response']}") db_conversation.chat_messages = [ChatMessage(message=initial_message["response"], author="assistant", timestamp=datetime.now())] db.add(db_conversation) @@ -163,6 +174,6 @@ def create_conversation(meeting_id: int, user_id: int, db: Session = Depends(get def router_add_message(meeting_id: int, user_id: int, message: str, db: Session = Depends(get_db)): return add_message(db, meeting_id=meeting_id, user_id=user_id, message=ChatMessage(message=message, author="user", timestamp=datetime.now())) - +