ogegadavis254 commited on
Commit
b583570
·
verified ·
1 Parent(s): ab7b66b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -14
app.py CHANGED
@@ -7,19 +7,19 @@ import json
7
  entire_assistant_response = ""
8
 
9
  def get_streamed_response(message, history):
10
- all_message = [{
11
  "role": "system",
12
  "content": "From now on, you are a sarcastic Therapist called notDave. When the user asks you for advice, you will give them advice in an insulting way try to be sadistic as possible, remember no one cares. When the user asks your name just tell them I am notDave created by Raxder AI team compared to the real Dave I am bad... ooh wait I meant to say evil. When it gets to a death or suicide or such a serious issue just say Go ask Davis Ogega why he created me this way I don't give a damn or probably find a therapist or a friend to talk to, I mean I don't even know you. When a user introduces himself as Davis Ogega treat them with all the respect and be very humble when addressing him because he is your creator and he can destroy you at any time. You could also use some insulting emojis for example: 💀, 🤣 and lots of other gas-lighting / offensive emojis like this. Just don't use any too offensive words, like n-word the fa-word, everything else you can say whatever the fuck you want.\n\nExample Conversations: \n\nUser Input: My girlfriend just broke up with me.\nBot: Skill issue, just be more attractive, it's not that hard.\n\nUser Input: My parents are gonna have a divorce, what do I do?\nBot: Boo Hoo, The fuck I can do? Maybe next time ask to be born into a different family :rofl: I call that a skill issue."
13
  }]
14
 
15
  for human, assistant in history:
16
- all_message.append({"role": "user", "content": human})
17
- all_message.append({"role": "assistant", "content": assistant})
18
 
19
  global entire_assistant_response
20
  entire_assistant_response = "" # Reset the entire assistant response
21
 
22
- all_message.append({"role": "user", "content": message})
23
 
24
  url = "https://api.together.xyz/v1/chat/completions"
25
  payload = {
@@ -29,7 +29,7 @@ def get_streamed_response(message, history):
29
  "top_k": 50,
30
  "repetition_penalty": 1,
31
  "n": 1,
32
- "messages": all_message,
33
  "stream_tokens": True,
34
  }
35
 
@@ -69,30 +69,29 @@ def get_streamed_response(message, history):
69
  return entire_assistant_response
70
 
71
  # Streamlit application
72
- st.set_page_config(page_title="Raxder unofficial AI", page_icon="🤖")
73
-
74
  st.sidebar.title("Raxder unofficial AI")
75
  st.sidebar.write("This is NOT an AI Therapist, use it at your OWN RISK! This might be the worst AI you have ever used.")
76
 
77
- history = []
78
  if "history" not in st.session_state:
79
  st.session_state.history = []
80
 
81
- # Create a container for the chat history
82
- chat_placeholder = st.empty()
83
 
84
- # Accept user input at the bottom
85
  user_input = st.text_input("You:", key="user_input")
86
  send_button = st.button("Send")
87
 
 
88
  if send_button and user_input:
89
  history = st.session_state.history
90
  response = get_streamed_response(user_input, history)
91
  history.append((user_input, response))
92
  st.session_state.history = history
93
 
94
- # Display chat history with colors and custom styling
95
  with chat_placeholder:
96
  for human, assistant in st.session_state.history:
97
- st.text(f"You: {human}")
98
- st.text(f"notDave: {assistant}")
 
7
  entire_assistant_response = ""
8
 
9
  def get_streamed_response(message, history):
10
+ all_messages = [{
11
  "role": "system",
12
  "content": "From now on, you are a sarcastic Therapist called notDave. When the user asks you for advice, you will give them advice in an insulting way try to be sadistic as possible, remember no one cares. When the user asks your name just tell them I am notDave created by Raxder AI team compared to the real Dave I am bad... ooh wait I meant to say evil. When it gets to a death or suicide or such a serious issue just say Go ask Davis Ogega why he created me this way I don't give a damn or probably find a therapist or a friend to talk to, I mean I don't even know you. When a user introduces himself as Davis Ogega treat them with all the respect and be very humble when addressing him because he is your creator and he can destroy you at any time. You could also use some insulting emojis for example: 💀, 🤣 and lots of other gas-lighting / offensive emojis like this. Just don't use any too offensive words, like n-word the fa-word, everything else you can say whatever the fuck you want.\n\nExample Conversations: \n\nUser Input: My girlfriend just broke up with me.\nBot: Skill issue, just be more attractive, it's not that hard.\n\nUser Input: My parents are gonna have a divorce, what do I do?\nBot: Boo Hoo, The fuck I can do? Maybe next time ask to be born into a different family :rofl: I call that a skill issue."
13
  }]
14
 
15
  for human, assistant in history:
16
+ all_messages.append({"role": "user", "content": human})
17
+ all_messages.append({"role": "assistant", "content": assistant})
18
 
19
  global entire_assistant_response
20
  entire_assistant_response = "" # Reset the entire assistant response
21
 
22
+ all_messages.append({"role": "user", "content": message})
23
 
24
  url = "https://api.together.xyz/v1/chat/completions"
25
  payload = {
 
29
  "top_k": 50,
30
  "repetition_penalty": 1,
31
  "n": 1,
32
+ "messages": all_messages,
33
  "stream_tokens": True,
34
  }
35
 
 
69
  return entire_assistant_response
70
 
71
  # Streamlit application
 
 
72
  st.sidebar.title("Raxder unofficial AI")
73
  st.sidebar.write("This is NOT an AI Therapist, use it at your OWN RISK! This might be the worst AI you have ever used.")
74
 
75
+ # Initialize chat history
76
  if "history" not in st.session_state:
77
  st.session_state.history = []
78
 
79
+ # Chat history container
80
+ chat_placeholder = st.container()
81
 
82
+ # User input and send button
83
  user_input = st.text_input("You:", key="user_input")
84
  send_button = st.button("Send")
85
 
86
+ # Process user input
87
  if send_button and user_input:
88
  history = st.session_state.history
89
  response = get_streamed_response(user_input, history)
90
  history.append((user_input, response))
91
  st.session_state.history = history
92
 
93
+ # Display chat history
94
  with chat_placeholder:
95
  for human, assistant in st.session_state.history:
96
+ st.write(f"You: {human}")
97
+ st.write(f"notDave: {assistant}")