Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import os
|
|
| 4 |
import sys
|
| 5 |
import requests
|
| 6 |
import csv
|
|
|
|
| 7 |
|
| 8 |
my_api_key = '' # 在这里输入你的 API 密钥
|
| 9 |
HIDE_MY_KEY = False # 如果你想在UI中隐藏你的 API 密钥,将此值设置为 True
|
|
@@ -75,7 +76,11 @@ def parse_text(text):
|
|
| 75 |
def predict(inputs, top_p, temperature, openai_api_key, chatbot=[], history=[], system_prompt=initial_prompt,
|
| 76 |
retry=False, summary=False): # repetition_penalty, top_k
|
| 77 |
|
|
|
|
|
|
|
|
|
|
| 78 |
print(f"chatbot 1: {chatbot}")
|
|
|
|
| 79 |
|
| 80 |
headers = {
|
| 81 |
"Content-Type": "application/json",
|
|
@@ -85,6 +90,7 @@ def predict(inputs, top_p, temperature, openai_api_key, chatbot=[], history=[],
|
|
| 85 |
chat_counter = len(history) // 2
|
| 86 |
|
| 87 |
print(f"chat_counter - {chat_counter}")
|
|
|
|
| 88 |
|
| 89 |
messages = [compose_system(system_prompt)]
|
| 90 |
if chat_counter:
|
|
|
|
| 4 |
import sys
|
| 5 |
import requests
|
| 6 |
import csv
|
| 7 |
+
import time
|
| 8 |
|
| 9 |
my_api_key = '' # 在这里输入你的 API 密钥
|
| 10 |
HIDE_MY_KEY = False # 如果你想在UI中隐藏你的 API 密钥,将此值设置为 True
|
|
|
|
| 76 |
def predict(inputs, top_p, temperature, openai_api_key, chatbot=[], history=[], system_prompt=initial_prompt,
|
| 77 |
retry=False, summary=False): # repetition_penalty, top_k
|
| 78 |
|
| 79 |
+
print('\n\n\n')
|
| 80 |
+
print(time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())))
|
| 81 |
+
print('\n')
|
| 82 |
print(f"chatbot 1: {chatbot}")
|
| 83 |
+
print('\n')
|
| 84 |
|
| 85 |
headers = {
|
| 86 |
"Content-Type": "application/json",
|
|
|
|
| 90 |
chat_counter = len(history) // 2
|
| 91 |
|
| 92 |
print(f"chat_counter - {chat_counter}")
|
| 93 |
+
print('\n\n\n')
|
| 94 |
|
| 95 |
messages = [compose_system(system_prompt)]
|
| 96 |
if chat_counter:
|