Spaces:
Sleeping
Sleeping
Update chatbot_page.py
Browse files- chatbot_page.py +3 -1
chatbot_page.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from analyzer import analyze_code
|
| 3 |
|
| 4 |
# System prompt for the chatbot
|
| 5 |
CHATBOT_SYSTEM_PROMPT = (
|
|
@@ -36,6 +36,7 @@ def chat_with_user(user_message, history):
|
|
| 36 |
|
| 37 |
# Function to end chat and extract keywords
|
| 38 |
def extract_keywords_from_conversation(history):
|
|
|
|
| 39 |
from openai import OpenAI
|
| 40 |
client = OpenAI()
|
| 41 |
# Combine all user and assistant messages into a single string
|
|
@@ -57,6 +58,7 @@ def extract_keywords_from_conversation(history):
|
|
| 57 |
max_tokens=64,
|
| 58 |
temperature=0.3
|
| 59 |
)
|
|
|
|
| 60 |
print(response.choices[0].message.content)
|
| 61 |
keywords = response.choices[0].message.content.strip()
|
| 62 |
return keywords
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
# from analyzer import analyze_code
|
| 3 |
|
| 4 |
# System prompt for the chatbot
|
| 5 |
CHATBOT_SYSTEM_PROMPT = (
|
|
|
|
| 36 |
|
| 37 |
# Function to end chat and extract keywords
|
| 38 |
def extract_keywords_from_conversation(history):
|
| 39 |
+
print("Extracting keywords from conversation...")
|
| 40 |
from openai import OpenAI
|
| 41 |
client = OpenAI()
|
| 42 |
# Combine all user and assistant messages into a single string
|
|
|
|
| 58 |
max_tokens=64,
|
| 59 |
temperature=0.3
|
| 60 |
)
|
| 61 |
+
print("Response received from OpenAI...")
|
| 62 |
print(response.choices[0].message.content)
|
| 63 |
keywords = response.choices[0].message.content.strip()
|
| 64 |
return keywords
|