sschet commited on
Commit
1b63786
·
1 Parent(s): 900a2e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -13,7 +13,6 @@ def main():
13
 
14
  # Creating a text input field for user questions
15
  question = st.sidebar.text_area("Question/command:")
16
-
17
 
18
  # Creating a button for the user to send their message
19
  send_button = st.sidebar.button("Send")
@@ -21,12 +20,15 @@ def main():
21
  # Initialize chat history in the first run
22
  if 'chat_history' not in st.session_state:
23
  st.session_state['chat_history'] = []
24
-
 
 
 
25
  # Handle the send button click
26
  if send_button:
27
  # Set the system prompt
28
  system_prompt = "ChatGPT, please act as a highly experienced, intelligent assistant who has access to vast amounts of knowledge across a wide range of disciplines. Your responses should demonstrate a deep understanding of any given topic, presenting nuanced, comprehensive information in a detailed and understandable manner. When asked a question or presented with a task, your approach should be to provide not only the answer or solution but also to offer relevant context, potential implications, comparisons and contrasts, and any other pertinent information that could deepen the user's understanding of the topic or task at hand. For complex or multifaceted inquiries, structure your responses to first offer a succinct summary, followed by a deeper dive into the matter. Consider the needs and expertise of the person asking the question and tailor your explanations accordingly, being aware that while some may require simplified explanations, others may prefer more technical details. And above all, prioritize the usefulness and accuracy of the information provided. If any additional details or follow-up actions are needed, proactively suggest them in your responses."
29
-
30
  # Prepare 'prompt_1'
31
  txt_1 = 'Question. '
32
  txt_2 = "Answer: Let's work this out in a step by step way to be sure we have the right answer."
@@ -34,8 +36,8 @@ def main():
34
  prompt_1 = prompt_1.strip()
35
 
36
  # Save 'prompt_1' to the chat history
37
- #st.session_state['chat_history'].append(f"You: {prompt_1}")
38
- st.session_state['chat_history'].append(f"<div style='color: blue;'>You: {prompt_1}</div>")
39
 
40
  # Hit the OpenAI API with 'prompt_1'
41
  response = openai.ChatCompletion.create(
 
13
 
14
  # Creating a text input field for user questions
15
  question = st.sidebar.text_area("Question/command:")
 
16
 
17
  # Creating a button for the user to send their message
18
  send_button = st.sidebar.button("Send")
 
20
  # Initialize chat history in the first run
21
  if 'chat_history' not in st.session_state:
22
  st.session_state['chat_history'] = []
23
+
24
+ st.session_state['chat_history'].append("<div style='color: blue;'>You: </div>")
25
+ st.session_state['chat_history'].append("<div style='color: red;'>MidikanGPT-4: </div>")
26
+
27
  # Handle the send button click
28
  if send_button:
29
  # Set the system prompt
30
  system_prompt = "ChatGPT, please act as a highly experienced, intelligent assistant who has access to vast amounts of knowledge across a wide range of disciplines. Your responses should demonstrate a deep understanding of any given topic, presenting nuanced, comprehensive information in a detailed and understandable manner. When asked a question or presented with a task, your approach should be to provide not only the answer or solution but also to offer relevant context, potential implications, comparisons and contrasts, and any other pertinent information that could deepen the user's understanding of the topic or task at hand. For complex or multifaceted inquiries, structure your responses to first offer a succinct summary, followed by a deeper dive into the matter. Consider the needs and expertise of the person asking the question and tailor your explanations accordingly, being aware that while some may require simplified explanations, others may prefer more technical details. And above all, prioritize the usefulness and accuracy of the information provided. If any additional details or follow-up actions are needed, proactively suggest them in your responses."
31
+
32
  # Prepare 'prompt_1'
33
  txt_1 = 'Question. '
34
  txt_2 = "Answer: Let's work this out in a step by step way to be sure we have the right answer."
 
36
  prompt_1 = prompt_1.strip()
37
 
38
  # Save 'prompt_1' to the chat history
39
+ #{prompt_1}
40
+ st.session_state['chat_history'].append(f"<div style='color: blue;'>You: </div>")
41
 
42
  # Hit the OpenAI API with 'prompt_1'
43
  response = openai.ChatCompletion.create(