Skip to content

Commit

Permalink
支持最新的gpt-4-o模型,并重定向gpt-4-mobile到gpt-4-s
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanyutin753 committed May 16, 2024
1 parent 21fd5b8 commit 3cc2755
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions main.py
Original file line number Diff line number Diff line change
@@ -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 base64
import hashlib
import json
import time
import logging
import os
import uuid
from datetime import datetime
from PIL import Image
import io
import re
import threading
from queue import Queue, Empty
import logging
from io import BytesIO
from logging.handlers import TimedRotatingFileHandler
import uuid
import hashlib
from queue import Queue
from urllib.parse import urlparse

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 os
from urllib.parse import urlparse
from flask import Flask, request, jsonify, Response, send_from_directory
from flask_apscheduler import APScheduler
from flask_cors import CORS, cross_origin


# 读取配置文件
Expand Down Expand Up @@ -133,7 +122,6 @@ def load_config(file_path):
# 创建FakeUserAgent对象
ua = UserAgent()

import random
import threading

# 开启线程锁
Expand Down Expand Up @@ -336,9 +324,9 @@ def generate_gpts_payload(model, messages):
# 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():
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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.",
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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"""
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<p> Thanks for using RefreshToV1Api {VERSION}</p>
<p> 感谢Ink-Osier大佬的付出,敬礼!!!</p>
<p><a href="https://github.com/Yanyutin753/RefreshToV1Api">项目地址</a></p>
</body>
</html>
"""
return html_string, 500


@app.route('/images/<filename>')
Expand Down

0 comments on commit 3cc2755

Please sign in to comment.