Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ openai.api_key = os.getenv('OpenAPI')
|
|
| 7 |
|
| 8 |
chat_history = ""
|
| 9 |
|
| 10 |
-
def call_openai_api(user_prompt
|
| 11 |
global chat_history
|
| 12 |
|
| 13 |
text = """
|
|
@@ -39,7 +39,8 @@ def call_openai_api(user_prompt, stream='true'):
|
|
| 39 |
messages=[
|
| 40 |
{"role": "system", "content": "You are a research assistant. Provide factual short answers to your prompts."},
|
| 41 |
{"role": "user", "content": f"{text}\n\n{user_prompt}"},
|
| 42 |
-
]
|
|
|
|
| 43 |
)
|
| 44 |
ai_response = response.choices[0].message['content']
|
| 45 |
chat_history += f"\nUser: {user_prompt}\nAI: {ai_response}"
|
|
|
|
| 7 |
|
| 8 |
chat_history = ""
|
| 9 |
|
| 10 |
+
def call_openai_api(user_prompt):
|
| 11 |
global chat_history
|
| 12 |
|
| 13 |
text = """
|
|
|
|
| 39 |
messages=[
|
| 40 |
{"role": "system", "content": "You are a research assistant. Provide factual short answers to your prompts."},
|
| 41 |
{"role": "user", "content": f"{text}\n\n{user_prompt}"},
|
| 42 |
+
],
|
| 43 |
+
stream=true
|
| 44 |
)
|
| 45 |
ai_response = response.choices[0].message['content']
|
| 46 |
chat_history += f"\nUser: {user_prompt}\nAI: {ai_response}"
|