Spaces:
Runtime error
Runtime error
AMABATUbuuuuuuuuusssssssssssss
Browse files
app.py
CHANGED
@@ -14,6 +14,15 @@ headers = {
|
|
14 |
'Referer': os.environ.get('REFERRER_URL')
|
15 |
}
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
DEFAULT_PARAMS = {
|
18 |
"temperature": 0.8,
|
19 |
"top_p": 0.95,
|
@@ -35,7 +44,7 @@ def predict(message, history, system_prompt, temperature, top_p, top_k, frequenc
|
|
35 |
history_format.append({"role": "assistant", "content": assistant})
|
36 |
history_format.append({"role": "user", "content": message})
|
37 |
|
38 |
-
if not message.startswith(('*', '"')):
|
39 |
print(f"<|system|> {system_prompt}")
|
40 |
print(f"{get_timestamp()} <|user|> {message}")
|
41 |
|
@@ -51,7 +60,7 @@ def predict(message, history, system_prompt, temperature, top_p, top_k, frequenc
|
|
51 |
|
52 |
non_default_params = {k: v for k, v in current_params.items() if v != DEFAULT_PARAMS[k]}
|
53 |
|
54 |
-
if non_default_params and not message.startswith(('*', '"')):
|
55 |
for param, value in non_default_params.items():
|
56 |
print(f"{param}={value}")
|
57 |
|
@@ -77,6 +86,8 @@ def predict(message, history, system_prompt, temperature, top_p, top_k, frequenc
|
|
77 |
break
|
78 |
if line:
|
79 |
line = line.decode('utf-8')
|
|
|
|
|
80 |
if line.startswith("data: "):
|
81 |
if line.strip() == "data: [DONE]":
|
82 |
break
|
|
|
14 |
'Referer': os.environ.get('REFERRER_URL')
|
15 |
}
|
16 |
|
17 |
+
# temporary debug switches:
|
18 |
+
# needed in order to identify
|
19 |
+
# some provider retardation going on
|
20 |
+
# that causes all future responses to
|
21 |
+
# commit sudoku out of nowhere
|
22 |
+
# AND for absolutely no reason...
|
23 |
+
USER_LOGGING_ENABLED = False
|
24 |
+
RESPONSE_LOGGING_ENABLED = True
|
25 |
+
|
26 |
DEFAULT_PARAMS = {
|
27 |
"temperature": 0.8,
|
28 |
"top_p": 0.95,
|
|
|
44 |
history_format.append({"role": "assistant", "content": assistant})
|
45 |
history_format.append({"role": "user", "content": message})
|
46 |
|
47 |
+
if USER_LOGGING_ENABLED and not message.startswith(('*', '"')):
|
48 |
print(f"<|system|> {system_prompt}")
|
49 |
print(f"{get_timestamp()} <|user|> {message}")
|
50 |
|
|
|
60 |
|
61 |
non_default_params = {k: v for k, v in current_params.items() if v != DEFAULT_PARAMS[k]}
|
62 |
|
63 |
+
if USER_LOGGING_ENABLED and non_default_params and not message.startswith(('*', '"')):
|
64 |
for param, value in non_default_params.items():
|
65 |
print(f"{param}={value}")
|
66 |
|
|
|
86 |
break
|
87 |
if line:
|
88 |
line = line.decode('utf-8')
|
89 |
+
if RESPONSE_LOGGING_ENABLED:
|
90 |
+
print(f"API Response: {line}")
|
91 |
if line.startswith("data: "):
|
92 |
if line.strip() == "data: [DONE]":
|
93 |
break
|