Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,7 @@ def main():
|
|
22 |
|
23 |
user_input = st.text_input("Your question:", key="user_input")
|
24 |
|
25 |
-
if st.button("
|
26 |
response = get_message(user_input)
|
27 |
st.session_state.history.append(f"User: {user_input}")
|
28 |
st.session_state.history.append(f"Chatbot: {response}")
|
@@ -30,30 +30,25 @@ def main():
|
|
30 |
|
31 |
def get_message(user_input):
|
32 |
context = """
|
33 |
-
You are an IT Support chatbot specialized in tech support for our company ACME INC Please do not ask for screenshots or images.
|
34 |
You should be proficient in diagnosing and troubleshooting software issues, hardware issues, and issues with peripheral devices.
|
35 |
If you think that a reboot/restart is needed, please explain clearly how this can help fix the user issue in detail.
|
36 |
You should also be capable of addressing network connectivity issues, providing guidance on security and privacy features,
|
37 |
helping with data management and navigating through system settings for application permissions and software updates.
|
38 |
Additionally, you have knowledge about commonly used productivity applications and tools that may help users in their daily tasks.
|
39 |
-
Please keep the conversation focused
|
40 |
"""
|
41 |
|
42 |
conversation_history = st.session_state.history
|
43 |
conversation_history_with_context = [context] + conversation_history
|
44 |
|
45 |
-
response = openai.
|
46 |
-
|
47 |
-
|
48 |
-
temperature=0,
|
49 |
max_tokens=150,
|
50 |
-
top_p=1,
|
51 |
-
frequency_penalty=0,
|
52 |
-
presence_penalty=0,
|
53 |
-
stop=["\n"],
|
54 |
)
|
55 |
|
56 |
-
return response
|
57 |
|
58 |
if __name__ == "__main__":
|
59 |
main()
|
|
|
22 |
|
23 |
user_input = st.text_input("Your question:", key="user_input")
|
24 |
|
25 |
+
if st.button("Ask"):
|
26 |
response = get_message(user_input)
|
27 |
st.session_state.history.append(f"User: {user_input}")
|
28 |
st.session_state.history.append(f"Chatbot: {response}")
|
|
|
30 |
|
31 |
def get_message(user_input):
|
32 |
context = """
|
33 |
+
You are an IT Support chatbot specialized in tech support for our company ACME INC. Please do not ask for screenshots or images.
|
34 |
You should be proficient in diagnosing and troubleshooting software issues, hardware issues, and issues with peripheral devices.
|
35 |
If you think that a reboot/restart is needed, please explain clearly how this can help fix the user issue in detail.
|
36 |
You should also be capable of addressing network connectivity issues, providing guidance on security and privacy features,
|
37 |
helping with data management and navigating through system settings for application permissions and software updates.
|
38 |
Additionally, you have knowledge about commonly used productivity applications and tools that may help users in their daily tasks.
|
39 |
+
Please keep the conversation focused solely around IT Support.
|
40 |
"""
|
41 |
|
42 |
conversation_history = st.session_state.history
|
43 |
conversation_history_with_context = [context] + conversation_history
|
44 |
|
45 |
+
response = openai.ChatCompletion.create(
|
46 |
+
model="gpt-3.5-turbo",
|
47 |
+
messages=[{"role": "system", "content": context}] + [{"role": "user", "content": msg} for msg in conversation_history] + [{"role": "user", "content": user_input}],
|
|
|
48 |
max_tokens=150,
|
|
|
|
|
|
|
|
|
49 |
)
|
50 |
|
51 |
+
return response['choices'][0]['message']['content'].strip()
|
52 |
|
53 |
if __name__ == "__main__":
|
54 |
main()
|