mirror of
https://github.com/Yanyutin753/RefreshToV1Api.git
synced 2025-10-22 20:12:26 +00:00
支持填错gpt-4-gizmo-XXX,回退成gpt-3.5-turbo
This commit is contained in:
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
*.json
|
||||||
|
*.log
|
||||||
|
*.json
|
||||||
|
*.log
|
1162
log/access.log
1162
log/access.log
File diff suppressed because it is too large
Load Diff
33
main.py
33
main.py
@@ -322,9 +322,9 @@ scheduler.start()
|
|||||||
# PANDORA_UPLOAD_URL = 'files.pandoranext.com'
|
# PANDORA_UPLOAD_URL = 'files.pandoranext.com'
|
||||||
|
|
||||||
|
|
||||||
VERSION = '0.7.8.1'
|
VERSION = '0.7.8.2'
|
||||||
# VERSION = 'test'
|
# VERSION = 'test'
|
||||||
UPDATE_INFO = '支持gpt-4-gizmo-XXX,动态配置GPTS'
|
UPDATE_INFO = '支持填错gpt-4-gizmo-XXX,回退成gpt-3.5-turbo'
|
||||||
|
|
||||||
|
|
||||||
# UPDATE_INFO = '【仅供临时测试使用】 '
|
# UPDATE_INFO = '【仅供临时测试使用】 '
|
||||||
@@ -947,7 +947,28 @@ def send_text_prompt_and_get_response(messages, api_key, stream, model):
|
|||||||
logger.info(f"Model already exists in the list, skipping...")
|
logger.info(f"Model already exists in the list, skipping...")
|
||||||
payload = generate_gpts_payload(model, formatted_messages)
|
payload = generate_gpts_payload(model, formatted_messages)
|
||||||
else:
|
else:
|
||||||
raise Exception('KEY_FOR_GPTS_INFO is not accessible')
|
payload = {
|
||||||
|
# 构建 payload
|
||||||
|
"action": "next",
|
||||||
|
"messages": formatted_messages,
|
||||||
|
"parent_message_id": str(uuid.uuid4()),
|
||||||
|
"model": "text-davinci-002-render-sha",
|
||||||
|
"timezone_offset_min": -480,
|
||||||
|
"suggestions": [
|
||||||
|
"What are 5 creative things I could do with my kids' art? I don't want to throw them away, but it's also so much clutter.",
|
||||||
|
"I want to cheer up my friend who's having a rough day. Can you suggest a couple short and sweet text messages to go with a kitten gif?",
|
||||||
|
"Come up with 5 concepts for a retro-style arcade game.",
|
||||||
|
"I have a photoshoot tomorrow. Can you recommend me some colors and outfit options that will look good on camera?"
|
||||||
|
],
|
||||||
|
"history_and_training_disabled": False,
|
||||||
|
"arkose_token": None,
|
||||||
|
"conversation_mode": {
|
||||||
|
"kind": "primary_assistant"
|
||||||
|
},
|
||||||
|
"force_paragen": False,
|
||||||
|
"force_rate_limit": False
|
||||||
|
}
|
||||||
|
logger.debug('KEY_FOR_GPTS_INFO Or Request Model is not accessible')
|
||||||
|
|
||||||
else:
|
else:
|
||||||
payload = generate_gpts_payload(model, formatted_messages)
|
payload = generate_gpts_payload(model, formatted_messages)
|
||||||
@@ -1124,7 +1145,7 @@ def replace_sandbox(text, conversation_id, message_id, api_key):
|
|||||||
sandbox_path = match.group(1)
|
sandbox_path = match.group(1)
|
||||||
download_url = get_download_url(conversation_id, message_id, sandbox_path)
|
download_url = get_download_url(conversation_id, message_id, sandbox_path)
|
||||||
if download_url == None:
|
if download_url == None:
|
||||||
return "\n```\nError: 沙箱文件下载失败,这可能是因为您启用了隐私模式\n```"
|
return "\n```\nError: 沙箱文件下载失败,这可能是因为您的帐号启用了隐私模式\n```"
|
||||||
file_name = extract_filename(download_url)
|
file_name = extract_filename(download_url)
|
||||||
timestamped_file_name = timestamp_filename(file_name)
|
timestamped_file_name = timestamp_filename(file_name)
|
||||||
if USE_OAIUSERCONTENT_URL == False:
|
if USE_OAIUSERCONTENT_URL == False:
|
||||||
@@ -1192,7 +1213,7 @@ def generate_actions_allow_payload(author_role, author_name, target_message_id,
|
|||||||
"action": "next",
|
"action": "next",
|
||||||
"messages": [
|
"messages": [
|
||||||
{
|
{
|
||||||
"id": generate_custom_uuid_v4(),
|
"id": str(uuid.uuid4()),
|
||||||
"author": {
|
"author": {
|
||||||
"role": author_role,
|
"role": author_role,
|
||||||
"name": author_name
|
"name": author_name
|
||||||
@@ -2043,7 +2064,7 @@ def old_data_fetcher(upstream_response, data_queue, stop_event, last_data_time,
|
|||||||
"id": chat_message_id,
|
"id": chat_message_id,
|
||||||
"object": "chat.completion.chunk",
|
"object": "chat.completion.chunk",
|
||||||
"created": timestamp,
|
"created": timestamp,
|
||||||
"model": message.get("metadata", {}).get("model_slug"),
|
"model": model,
|
||||||
"choices": [
|
"choices": [
|
||||||
{
|
{
|
||||||
"index": 0,
|
"index": 0,
|
||||||
|
3
start.sh
3
start.sh
@@ -31,4 +31,5 @@ echo "PROCESS_WORKERS: ${PROCESS_WORKERS}"
|
|||||||
echo "PROCESS_THREADS: ${PROCESS_THREADS}"
|
echo "PROCESS_THREADS: ${PROCESS_THREADS}"
|
||||||
|
|
||||||
# 启动 Gunicorn 并使用 tee 命令同时输出日志到文件和控制台
|
# 启动 Gunicorn 并使用 tee 命令同时输出日志到文件和控制台
|
||||||
exec gunicorn -w ${PROCESS_WORKERS} --threads ${PROCESS_THREADS} --bind 0.0.0.0:33333 main:app --access-logfile - --error-logfile -
|
exec gunicorn -w ${PROCESS_WORKERS} --threads ${PROCESS_THREADS} --bind 0.0.0.0:33333 main:app --access-logfile - --error-logfile - --timeout 60
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user