Spaces:
Sleeping
Sleeping
Tuchuanhuhuhu
commited on
Commit
•
dee274c
1
Parent(s):
ad19a5d
修复了代码块中的中文引号问题
Browse files- ChuanhuChatbot.py +6 -12
ChuanhuChatbot.py
CHANGED
@@ -8,7 +8,7 @@ import requests
|
|
8 |
# import markdown
|
9 |
import csv
|
10 |
|
11 |
-
my_api_key = "" # 在这里输入你的 API 密钥
|
12 |
initial_prompt = "You are a helpful assistant."
|
13 |
API_URL = "https://api.openai.com/v1/chat/completions"
|
14 |
HISTORY_DIR = "history"
|
@@ -54,20 +54,14 @@ def parse_text(text):
|
|
54 |
if i > 0:
|
55 |
if count % 2 == 1:
|
56 |
line = line.replace("&", "&")
|
57 |
-
line = line.replace("\"", "
|
58 |
-
|
59 |
-
line = line.replace("\'", "'")
|
60 |
-
# line = line.replace("\'", "'")
|
61 |
line = line.replace("<", "<")
|
62 |
line = line.replace(">", ">")
|
63 |
line = line.replace(" ", " ")
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
else:
|
68 |
-
lines[i] = '<br>'+line
|
69 |
-
return "".join(lines)
|
70 |
-
# text = "</br>".join([ i for i in "".join(lines).split("<br/>") if i != ""])
|
71 |
|
72 |
def predict(inputs, top_p, temperature, openai_api_key, chatbot=[], history=[], system_prompt=initial_prompt, retry=False, summary=False): # repetition_penalty, top_k
|
73 |
|
|
|
8 |
# import markdown
|
9 |
import csv
|
10 |
|
11 |
+
my_api_key = "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" # 在这里输入你的 API 密钥
|
12 |
initial_prompt = "You are a helpful assistant."
|
13 |
API_URL = "https://api.openai.com/v1/chat/completions"
|
14 |
HISTORY_DIR = "history"
|
|
|
54 |
if i > 0:
|
55 |
if count % 2 == 1:
|
56 |
line = line.replace("&", "&")
|
57 |
+
line = line.replace("\"", "`\"`")
|
58 |
+
line = line.replace("\'", "`\'`")
|
|
|
|
|
59 |
line = line.replace("<", "<")
|
60 |
line = line.replace(">", ">")
|
61 |
line = line.replace(" ", " ")
|
62 |
+
lines[i] = "<br>"+line
|
63 |
+
text = "".join(lines)
|
64 |
+
return text
|
|
|
|
|
|
|
|
|
65 |
|
66 |
def predict(inputs, top_p, temperature, openai_api_key, chatbot=[], history=[], system_prompt=initial_prompt, retry=False, summary=False): # repetition_penalty, top_k
|
67 |
|