AllenYkl commited on
Commit
5a68cd7
1 Parent(s): d8e436d

Update bin_public/config/presets.py

Browse files
Files changed (1) hide show
  1. bin_public/config/presets.py +25 -221
bin_public/config/presets.py CHANGED
@@ -1,232 +1,38 @@
 
1
  # -*- coding:utf-8 -*-
2
  title = """<h1 align="center">ChatGPT-dteam 🚀</h1>"""
3
- description = """<div align=center>
4
- </div>
5
- """
6
- customCSS = """
7
- :root {
8
- --chatbot-color-light: #F3F3F3;
9
- --chatbot-color-dark: #121111;
10
- }
11
-
12
- /* 覆盖gradio的页脚信息QAQ */
13
- footer {
14
- display: none !important;
15
- }
16
- #footer{
17
- text-align: center;
18
- }
19
- #footer div{
20
- display: inline-block;
21
- }
22
- #footer .versions{
23
- font-size: 85%;
24
- opacity: 0.85;
25
- }
26
-
27
- /* status_display */
28
- #status_display {
29
- display: flex;
30
- min-height: 2.5em;
31
- align-items: flex-end;
32
- justify-content: flex-end;
33
- }
34
- #status_display p {
35
- font-size: .85em;
36
- font-family: monospace;
37
- color: var(--body-text-color-subdued);
38
- }
39
 
40
- #chuanhu_chatbot, #status_display {
41
- transition: all 0.6s;
42
- }
43
 
44
- /* usage_display */
45
- #usage_display {
46
- position: relative;
47
- margin: 0;
48
- box-shadow: var(--block-shadow);
49
- border-width: var(--block-border-width);
50
- border-color: var(--block-border-color);
51
- border-radius: var(--block-radius);
52
- background: var(--block-background-fill);
53
- width: 100%;
54
- line-height: var(--line-sm);
55
- min-height: 2em;
56
- }
57
- #usage_display p, #usage_display span {
58
- margin: 0;
59
- padding: .5em 1em;
60
- font-size: .85em;
61
- color: var(--body-text-color-subdued);
62
- }
63
- .progress-bar {
64
- background-color: var(--input-background-fill);;
65
- margin: 0 1em;
66
- height: 20px;
67
- border-radius: 10px;
68
- overflow: hidden;
69
- }
70
- .progress {
71
- background-color: var(--block-title-background-fill);;
72
- height: 100%;
73
- border-radius: 10px;
74
- text-align: right;
75
- transition: width 0.5s ease-in-out;
76
- }
77
- .progress-text {
78
- /* color: white; */
79
- color: var(--color-accent) !important;
80
- font-size: 1em !important;
81
- font-weight: bold;
82
- padding-right: 10px;
83
- line-height: 20px;
84
- }
85
- /* list */
86
- ol:not(.options), ul:not(.options) {
87
- padding-inline-start: 2em !important;
88
- }
89
-
90
- /* 对话气泡 */
91
- [class *= "message"] {
92
- border-radius: var(--radius-xl) !important;
93
- border: none;
94
- padding: var(--spacing-xl) !important;
95
- font-size: var(--text-md) !important;
96
- line-height: var(--line-md) !important;
97
- min-height: calc(var(--text-md)*var(--line-md) + 2*var(--spacing-xl));
98
- min-width: calc(var(--text-md)*var(--line-md) + 2*var(--spacing-xl));
99
- }
100
- [data-testid = "bot"] {
101
- max-width: 85%;
102
- border-bottom-left-radius: 0 !important;
103
- }
104
- [data-testid = "user"] {
105
- max-width: 85%;
106
- width: auto !important;
107
- border-bottom-right-radius: 0 !important;
108
- }
109
- /* 表格 */
110
- table {
111
- margin: 1em 0;
112
- border-collapse: collapse;
113
- empty-cells: show;
114
- }
115
- td,th {
116
- border: 1.2px solid var(--border-color-primary) !important;
117
- padding: 0.2em;
118
- }
119
- thead {
120
- background-color: rgba(175,184,193,0.2);
121
- }
122
- thead th {
123
- padding: .5em .2em;
124
- }
125
- /* 行内代码 */
126
- code {
127
- display: inline;
128
- white-space: break-spaces;
129
- border-radius: 6px;
130
- margin: 0 2px 0 2px;
131
- padding: .2em .4em .1em .4em;
132
- background-color: rgba(175,184,193,0.2);
133
- }
134
- /* 代码块 */
135
- pre code {
136
- display: block;
137
- overflow: auto;
138
- white-space: pre;
139
- background-color: hsla(0, 0%, 0%, 80%)!important;
140
- border-radius: 10px;
141
- padding: 1.4em 1.2em 0em 1.4em;
142
- margin: 1.2em 2em 1.2em 0.5em;
143
- color: #FFF;
144
- box-shadow: 6px 6px 16px hsla(0, 0%, 0%, 0.2);
145
- }
146
- /* 代码高亮样式 */
147
- .highlight .hll { background-color: #49483e }
148
- .highlight .c { color: #75715e } /* Comment */
149
- .highlight .err { color: #960050; background-color: #1e0010 } /* Error */
150
- .highlight .k { color: #66d9ef } /* Keyword */
151
- .highlight .l { color: #ae81ff } /* Literal */
152
- .highlight .n { color: #f8f8f2 } /* Name */
153
- .highlight .o { color: #f92672 } /* Operator */
154
- .highlight .p { color: #f8f8f2 } /* Punctuation */
155
- .highlight .ch { color: #75715e } /* Comment.Hashbang */
156
- .highlight .cm { color: #75715e } /* Comment.Multiline */
157
- .highlight .cp { color: #75715e } /* Comment.Preproc */
158
- .highlight .cpf { color: #75715e } /* Comment.PreprocFile */
159
- .highlight .c1 { color: #75715e } /* Comment.Single */
160
- .highlight .cs { color: #75715e } /* Comment.Special */
161
- .highlight .gd { color: #f92672 } /* Generic.Deleted */
162
- .highlight .ge { font-style: italic } /* Generic.Emph */
163
- .highlight .gi { color: #a6e22e } /* Generic.Inserted */
164
- .highlight .gs { font-weight: bold } /* Generic.Strong */
165
- .highlight .gu { color: #75715e } /* Generic.Subheading */
166
- .highlight .kc { color: #66d9ef } /* Keyword.Constant */
167
- .highlight .kd { color: #66d9ef } /* Keyword.Declaration */
168
- .highlight .kn { color: #f92672 } /* Keyword.Namespace */
169
- .highlight .kp { color: #66d9ef } /* Keyword.Pseudo */
170
- .highlight .kr { color: #66d9ef } /* Keyword.Reserved */
171
- .highlight .kt { color: #66d9ef } /* Keyword.Type */
172
- .highlight .ld { color: #e6db74 } /* Literal.Date */
173
- .highlight .m { color: #ae81ff } /* Literal.Number */
174
- .highlight .s { color: #e6db74 } /* Literal.String */
175
- .highlight .na { color: #a6e22e } /* Name.Attribute */
176
- .highlight .nb { color: #f8f8f2 } /* Name.Builtin */
177
- .highlight .nc { color: #a6e22e } /* Name.Class */
178
- .highlight .no { color: #66d9ef } /* Name.Constant */
179
- .highlight .nd { color: #a6e22e } /* Name.Decorator */
180
- .highlight .ni { color: #f8f8f2 } /* Name.Entity */
181
- .highlight .ne { color: #a6e22e } /* Name.Exception */
182
- .highlight .nf { color: #a6e22e } /* Name.Function */
183
- .highlight .nl { color: #f8f8f2 } /* Name.Label */
184
- .highlight .nn { color: #f8f8f2 } /* Name.Namespace */
185
- .highlight .nx { color: #a6e22e } /* Name.Other */
186
- .highlight .py { color: #f8f8f2 } /* Name.Property */
187
- .highlight .nt { color: #f92672 } /* Name.Tag */
188
- .highlight .nv { color: #f8f8f2 } /* Name.Variable */
189
- .highlight .ow { color: #f92672 } /* Operator.Word */
190
- .highlight .w { color: #f8f8f2 } /* Text.Whitespace */
191
- .highlight .mb { color: #ae81ff } /* Literal.Number.Bin */
192
- .highlight .mf { color: #ae81ff } /* Literal.Number.Float */
193
- .highlight .mh { color: #ae81ff } /* Literal.Number.Hex */
194
- .highlight .mi { color: #ae81ff } /* Literal.Number.Integer */
195
- .highlight .mo { color: #ae81ff } /* Literal.Number.Oct */
196
- .highlight .sa { color: #e6db74 } /* Literal.String.Affix */
197
- .highlight .sb { color: #e6db74 } /* Literal.String.Backtick */
198
- .highlight .sc { color: #e6db74 } /* Literal.String.Char */
199
- .highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */
200
- .highlight .sd { color: #e6db74 } /* Literal.String.Doc */
201
- .highlight .s2 { color: #e6db74 } /* Literal.String.Double */
202
- .highlight .se { color: #ae81ff } /* Literal.String.Escape */
203
- .highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */
204
- .highlight .si { color: #e6db74 } /* Literal.String.Interpol */
205
- .highlight .sx { color: #e6db74 } /* Literal.String.Other */
206
- .highlight .sr { color: #e6db74 } /* Literal.String.Regex */
207
- .highlight .s1 { color: #e6db74 } /* Literal.String.Single */
208
- .highlight .ss { color: #e6db74 } /* Literal.String.Symbol */
209
- .highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */
210
- .highlight .fm { color: #a6e22e } /* Name.Function.Magic */
211
- .highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */
212
- .highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */
213
- .highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */
214
- .highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */
215
- .highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */
216
  """
217
 
218
  SIM_K = 5
219
  INDEX_QUERY_TEMPERATURE = 1.0
220
 
 
221
  summarize_prompt = "你是谁?我们刚才聊了什么?" # 总结对话时的 prompt
222
  # MODELS = ["gpt-3.5-turbo", "gpt-3.5-turbo-0301", "gpt-4","gpt-4-0314", "gpt-4-32k", "gpt-4-32k-0314"] # 可选的模型
223
- MODELS = ["gpt-3.5-turbo-0301"]
224
- websearch_prompt = """Web search results:
225
- {web_results}
226
- Current date: {current_date}
227
- Instructions: Using the provided web search results, write a comprehensive reply to the given query. Make sure to cite results using [[number](URL)] notation after the reference. If the provided search results refer to multiple subjects with the same name, write separate answers for each subject.
228
- Query: {query}
229
- """
 
 
 
 
 
230
 
231
  # 错误信息
232
  standard_error_msg = "☹️发生了错误:" # 错误信息的标准前缀
@@ -249,10 +55,8 @@ HIDE_MY_KEY = False # 如果你想在UI中隐藏你的 API 密钥,将此值设
249
 
250
  WEBSEARCH_PTOMPT_TEMPLATE = """\
251
  Web search results:
252
-
253
  {web_results}
254
  Current date: {current_date}
255
-
256
  Instructions: Using the provided web search results, write a comprehensive reply to the given query. Make sure to cite results using [[number](URL)] notation after the reference. If the provided search results refer to multiple subjects with the same name, write separate answers for each subject.
257
  Query: {query}
258
  Reply in 中文"""
@@ -282,4 +86,4 @@ We have the opportunity to refine the existing answer
282
  Given the new context, refine the original answer to better
283
  Answer in the same language as the question, such as English, 中文, 日本語, Español, Français, or Deutsch.
284
  If the context isn't useful, return the original answer.
285
- """
 
1
+ import gradio as gr
2
  # -*- coding:utf-8 -*-
3
  title = """<h1 align="center">ChatGPT-dteam 🚀</h1>"""
4
+ API_URL = "https://api.openai.com/v1/chat/completions"
5
+ BALANCE_API_URL="https://api.openai.com/dashboard/billing/credit_grants"
6
+ USAGE_API_URL="https://api.openai.com/dashboard/billing/usage"
7
+ Kelpy_Codos_Path = r"bin_public/config/Kelpy-Codos.js"
8
+ customJS_Path = r"bin_public/config/custom.js"
9
+ CSS_path = r"bin_public/config/CustomCSS.css"
10
+ HISTORY_DIR = "history"
11
+ TEMPLATES_DIR = "templates"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
 
 
 
13
 
14
+ description = """<div align=center>
15
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  """
17
 
18
  SIM_K = 5
19
  INDEX_QUERY_TEMPERATURE = 1.0
20
 
21
+ initial_prompt = "You are a helpful assistant."
22
  summarize_prompt = "你是谁?我们刚才聊了什么?" # 总结对话时的 prompt
23
  # MODELS = ["gpt-3.5-turbo", "gpt-3.5-turbo-0301", "gpt-4","gpt-4-0314", "gpt-4-32k", "gpt-4-32k-0314"] # 可选的模型
24
+ MODELS = ["gpt-3.5-turbo-0301", "gpt-4", "gpt-4-0314"]
25
+ REPLY_LANGUAGES = [
26
+ "中文",
27
+ "English",
28
+ "日本語",
29
+ "Español",
30
+ "Français",
31
+ "Deutsch",
32
+ "跟随问题语言(不稳定)"
33
+ ]
34
+
35
+
36
 
37
  # 错误信息
38
  standard_error_msg = "☹️发生了错误:" # 错误信息的标准前缀
 
55
 
56
  WEBSEARCH_PTOMPT_TEMPLATE = """\
57
  Web search results:
 
58
  {web_results}
59
  Current date: {current_date}
 
60
  Instructions: Using the provided web search results, write a comprehensive reply to the given query. Make sure to cite results using [[number](URL)] notation after the reference. If the provided search results refer to multiple subjects with the same name, write separate answers for each subject.
61
  Query: {query}
62
  Reply in 中文"""
 
86
  Given the new context, refine the original answer to better
87
  Answer in the same language as the question, such as English, 中文, 日本語, Español, Français, or Deutsch.
88
  If the context isn't useful, return the original answer.
89
+ """