Skip to content

Commit

Permalink
added meeting title and name
Browse files Browse the repository at this point in the history
  • Loading branch information
GuidoGrogger committed Sep 30, 2024
1 parent 64a06b0 commit 8cd82c9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
5 changes: 3 additions & 2 deletions backend/app/ai_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
15 changes: 13 additions & 2 deletions backend/app/routers/meetings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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()))




0 comments on commit 8cd82c9

Please sign in to comment.