mirror of
https://github.com/Yanyutin753/RefreshToV1Api.git
synced 2025-12-10 01:03:03 +08:00
支持gpt-4-gizmo-XXX,填错自动回退gpt-3.5-turbo
This commit is contained in:
31
main.py
31
main.py
@@ -321,9 +321,9 @@ scheduler.start()
|
||||
# PANDORA_UPLOAD_URL = 'files.pandoranext.com'
|
||||
|
||||
|
||||
VERSION = '0.7.7.1'
|
||||
VERSION = '0.7.7.2'
|
||||
# VERSION = 'test'
|
||||
UPDATE_INFO = '支持gpt-4-gizmo-XXX,动态配置GPTS'
|
||||
UPDATE_INFO = '支持gpt-4-gizmo-XXX,填错自动回退gpt-3.5-turbo'
|
||||
# UPDATE_INFO = '【仅供临时测试使用】 '
|
||||
|
||||
# 解析响应中的信息
|
||||
@@ -944,7 +944,28 @@ def send_text_prompt_and_get_response(messages, api_key, stream, model):
|
||||
logger.info(f"Model already exists in the list, skipping...")
|
||||
payload = generate_gpts_payload(model, formatted_messages)
|
||||
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 is not accessible')
|
||||
else:
|
||||
payload = generate_gpts_payload(model, formatted_messages)
|
||||
if not payload:
|
||||
@@ -1188,7 +1209,7 @@ def generate_actions_allow_payload(author_role, author_name, target_message_id,
|
||||
"action": "next",
|
||||
"messages": [
|
||||
{
|
||||
"id": generate_custom_uuid_v4(),
|
||||
"id": str(uuid.uuid4()),
|
||||
"author": {
|
||||
"role": author_role,
|
||||
"name": author_name
|
||||
@@ -2039,7 +2060,7 @@ def old_data_fetcher(upstream_response, data_queue, stop_event, last_data_time,
|
||||
"id": chat_message_id,
|
||||
"object": "chat.completion.chunk",
|
||||
"created": timestamp,
|
||||
"model": message.get("metadata", {}).get("model_slug"),
|
||||
"model": model,
|
||||
"choices": [
|
||||
{
|
||||
"index": 0,
|
||||
|
||||
2
start.sh
2
start.sh
@@ -31,4 +31,4 @@ echo "PROCESS_WORKERS: ${PROCESS_WORKERS}"
|
||||
echo "PROCESS_THREADS: ${PROCESS_THREADS}"
|
||||
|
||||
# 启动 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