diff --git a/main.py b/main.py index 2026027..e1665f6 100644 --- a/main.py +++ b/main.py @@ -1,32 +1,21 @@ # 导入所需的库 -from flask import Flask, request, jsonify, Response, send_from_directory -from flask_cors import CORS, cross_origin -import requests -import uuid -import json -import time -import os -from datetime import datetime -from PIL import Image -import io -import re -import threading -from queue import Queue, Empty -import logging -from logging.handlers import TimedRotatingFileHandler -import uuid -import hashlib -import requests -import json -import hashlib -from PIL import Image -from io import BytesIO -from urllib.parse import urlparse, urlunparse import base64 -from fake_useragent import UserAgent +import hashlib +import json +import logging import os +import uuid +from datetime import datetime +from io import BytesIO +from logging.handlers import TimedRotatingFileHandler +from queue import Queue from urllib.parse import urlparse + +import requests +from fake_useragent import UserAgent +from flask import Flask, request, jsonify, Response, send_from_directory from flask_apscheduler import APScheduler +from flask_cors import CORS, cross_origin # 读取配置文件 @@ -133,7 +122,6 @@ logger.addHandler(stream_handler) # 创建FakeUserAgent对象 ua = UserAgent() -import random import threading # 开启线程锁 @@ -336,9 +324,9 @@ scheduler.start() # PANDORA_UPLOAD_URL = 'files.pandoranext.com' -VERSION = '0.7.9.2' +VERSION = '0.7.9.3' # VERSION = 'test' -UPDATE_INFO = '支持最新的gpt-4-o模型,且支持上传文件' +UPDATE_INFO = '支持最新的gpt-4-o模型,并重定向gpt-4-mobile到gpt-4-s' # UPDATE_INFO = '【仅供临时测试使用】 ' with app.app_context(): @@ -852,13 +840,9 @@ def send_text_prompt_and_get_response(messages, api_key, account_id, stream, mod "action": "next", "messages": formatted_messages, "parent_message_id": str(uuid.uuid4()), - "model": "gpt-4-mobile", + "model": "gpt-4", "timezone_offset_min": -480, - "suggestions": [ - "Give me 3 ideas about how to plan good New Years resolutions. Give me some that are personal, family, and professionally-oriented.", - "Write a text asking a friend to be my plus-one at a wedding next month. I want to keep it super short and casual, and offer an out.", - "Design a database schema for an online merch store.", - "Compare Gen Z and Millennial marketing strategies for sunglasses."], + "suggestions": [], "history_and_training_disabled": False, "conversation_mode": {"kind": "primary_assistant"}, "force_paragen": False, "force_rate_limit": False } @@ -890,7 +874,7 @@ def send_text_prompt_and_get_response(messages, api_key, account_id, stream, mod "action": "next", "messages": formatted_messages, "parent_message_id": str(uuid.uuid4()), - "model": "auto", + "model": "gpt-4o", "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.", @@ -1519,7 +1503,8 @@ def data_fetcher(upstream_response, data_queue, stop_event, last_data_time, api_ execution_output_image_url_buffer = f"{UPLOAD_BASE_URL}/{today_image_url}" else: - logger.error(f"下载图片失败: {image_download_response.text}") + logger.error( + f"下载图片失败: {image_download_response.text}") execution_output_image_id_buffer = image_file_id @@ -2390,7 +2375,22 @@ def catch_all(path): logger.debug(f"请求头: {request.headers}") logger.debug(f"请求体: {request.data}") - return jsonify({"message": "Welcome to Inker's World"}), 200 + html_string = f""" + + + + + + Document + + +

Thanks for using RefreshToV1Api {VERSION}

+

感谢Ink-Osier大佬的付出,敬礼!!!

+

项目地址

+ + + """ + return html_string, 500 @app.route('/images/')