Skip to content

Commit

Permalink
Promptaufbau umgestellt
Browse files Browse the repository at this point in the history
  • Loading branch information
TechPrototyper committed Apr 10, 2024
1 parent c78ba7c commit 6b7191c
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions API/azure_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,26 +152,27 @@ async def chat(self, user_name: str, user_email: str, user_prompt: str):
:return: Der Antworttext des Assistenten.
"""

# Methode zu lang. Aufteilung im kommenden Update.
u = UserThreads()
transscript_allowed = await u.get_extended_events(user_email)

if transscript_allowed == 1:
details = {"email": user_email, "Name: ": user_name,"prompt": user_prompt}
async with EventGridPublisher() as publisher:
await publisher.send_event(event = PromptFromUserEvent(details).to_cloudevent())
logging.info(f"Prompt von Benutzer {user_email} an EventGrid gesendet.")

# Create Prompt
# Timestamp für Prompt erstellen
time_stamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
logging.info(f"Timestamp: {time_stamp}")
modified_prompt = f"Mein Name: {user_name}\nDatum und Uhrzeit: {time_stamp}\nMitlesen erlaubt: {str(transscript_allowed)}\nMein Prompt: {user_prompt}"
logging.info(f"Modified Prompt: created.")
try:
# Prüfen, ob der Benutzer Transskripte erlaubt
thread_id = await self.get_or_create_thread(user_email)
logging.info(f"Thread ID: {thread_id}")

# Create prompt with user details
time_stamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
logging.info(f"Timestamp: {time_stamp}")
modified_prompt = f"Mein Name: {user_name}\nDatum und Uhrzeit: {time_stamp}\nMitlesen erlaubt: {str(transscript_allowed)}\nMein Prompt: {user_prompt}"
logging.info(f"Modified Prompt: created.")

u = UserThreads()
transscript_allowed = await u.get_extended_events(user_email)

if transscript_allowed == 1:
details = {"email": user_email, "Name: ": user_name,"prompt": user_prompt}
async with EventGridPublisher() as publisher:
await publisher.send_event(event = PromptFromUserEvent(details).to_cloudevent())
logging.info(f"Prompt von Benutzer {user_email} an EventGrid gesendet.")


while True:
# Neue Nachricht erzeugen
try:
Expand Down

0 comments on commit 6b7191c

Please sign in to comment.