Update app.py
Browse files
app.py
CHANGED
@@ -67,7 +67,7 @@ def generate_response(prompt: str) -> str:
|
|
67 |
|
68 |
|
69 |
|
70 |
-
def
|
71 |
try:
|
72 |
# Validate inputs
|
73 |
if not persona_prompt or not prompt:
|
@@ -150,7 +150,7 @@ async def start_chat(request: Request):
|
|
150 |
raise HTTPException(status_code=400, detail="Both prompt and contextual_prompt are required")
|
151 |
|
152 |
# Generate a response for the initial prompt
|
153 |
-
response =
|
154 |
|
155 |
# Generate a unique thread ID
|
156 |
thread_id = len(conversations) + 1
|
|
|
67 |
|
68 |
|
69 |
|
70 |
+
def generate_prompt_response(persona_prompt: str, prompt: str) -> dict:
|
71 |
try:
|
72 |
# Validate inputs
|
73 |
if not persona_prompt or not prompt:
|
|
|
150 |
raise HTTPException(status_code=400, detail="Both prompt and contextual_prompt are required")
|
151 |
|
152 |
# Generate a response for the initial prompt
|
153 |
+
response = generate_prompt_response(persona_prompt, prompt)
|
154 |
|
155 |
# Generate a unique thread ID
|
156 |
thread_id = len(conversations) + 1
|