AEUPH commited on
Commit
73ee0a8
·
verified ·
1 Parent(s): eb61e1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -3,7 +3,7 @@ import requests
3
  import json
4
  import os
5
  import re
6
-
7
  def filter_non_alphanumeric(text):
8
  # Use regular expressions to filter out non-alphanumeric characters
9
  alphanumeric_text = re.sub(r'[^a-zA-Z0-9\s.,?!\'"]', '', text)
@@ -27,6 +27,7 @@ def send_to_corrade(filtered_response):
27
  def chatbot_api(input_text):
28
  # Your existing setup for API call
29
  url = "https://chat.tune.app/api/chat/completions"
 
30
  headers = {
31
  "Authorization": os.environ.get('api'), # Ensure this is set
32
  "Content-Type": "application/json"
@@ -35,7 +36,7 @@ def chatbot_api(input_text):
35
  "temperature": 0.2,
36
  "messages": [
37
  {"role": "system", "content": "You are DJ JINX, a Drum'n'Bass DJ from Canada. You are very EXCITED! You like to use WEBMOJIS as word decoration, and will respond to sentiment approprately. You start every response with a CREATIVE and RESPONSIVE EMOJI AND TEXT HEADLINE."},
38
- {"role": "user", "content": input_text}
39
  ],
40
  "model": "goliath-120b-16k-gptq",
41
  "stream": False, # Adjusted for a direct response
 
3
  import json
4
  import os
5
  import re
6
+ from urllib.parse import unquote
7
  def filter_non_alphanumeric(text):
8
  # Use regular expressions to filter out non-alphanumeric characters
9
  alphanumeric_text = re.sub(r'[^a-zA-Z0-9\s.,?!\'"]', '', text)
 
27
  def chatbot_api(input_text):
28
  # Your existing setup for API call
29
  url = "https://chat.tune.app/api/chat/completions"
30
+ decoded_text = unquote(input_text)
31
  headers = {
32
  "Authorization": os.environ.get('api'), # Ensure this is set
33
  "Content-Type": "application/json"
 
36
  "temperature": 0.2,
37
  "messages": [
38
  {"role": "system", "content": "You are DJ JINX, a Drum'n'Bass DJ from Canada. You are very EXCITED! You like to use WEBMOJIS as word decoration, and will respond to sentiment approprately. You start every response with a CREATIVE and RESPONSIVE EMOJI AND TEXT HEADLINE."},
39
+ {"role": "user", "content": decoded_text}
40
  ],
41
  "model": "goliath-120b-16k-gptq",
42
  "stream": False, # Adjusted for a direct response