XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

Update model list

71adc96b
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

3 个文件 +803 -709
Modified g4f/gui/server/backend_api.py +13 -4
@@ -4,6 +4,7 @@ import json
4 4 import flask
5 5 import os
6 6 import time
7 import base64
7 8 import logging
8 9 import asyncio
9 10 import shutil
@@ -107,6 +108,12 @@ class Backend_Api(Api):
107 108
108 109 @app.route('/backend-api/v2/public-key', methods=['GET'])
109 110 def get_public_key():
111 if not has_crypto:
112 return jsonify({"error": {"message": "Crypto support is not available"}}), 501
113 if time.time() - int(base64.b64decode(request.cookies.get("fingerprint", "MA==")).decode()) > 60:
114 # If the fingerprint is older than 60 seconds, generate a new one
115 resp = jsonify({"error": {"message": "Please refresh the page"}})
116 return resp
110 117 # Send the public key to the client for encryption
111 118 return jsonify({
112 119 "public_key": public_key_pem.decode(),
@@ -270,10 +277,6 @@ class Backend_Api(Api):
270 277 )
271 278
272 279 self.routes = {
273 '/backend-api/v2/version': {
274 'function': self.get_version,
275 'methods': ['GET']
276 },
277 280 '/backend-api/v2/synthesize/<provider>': {
278 281 'function': self.handle_synthesize,
279 282 'methods': ['GET']
@@ -292,6 +295,12 @@ class Backend_Api(Api):
292 295 },
293 296 }
294 297
298 @app.route('/backend-api/v2/version', methods=['GET'])
299 def version():
300 resp = jsonify(self.get_version())
301 resp.set_cookie('fingerprint', base64.b64encode(str(int(time.time())).encode()).decode(), max_age=60, httponly=True, secure=True)
302 return resp
303
295 304 @app.route('/backend-api/v2/create', methods=['GET'])
296 305 def create():
297 306 try:
Modified g4f/providers/any_provider.py +5 -2
@@ -13,13 +13,14 @@ from ..Provider import Copilot, Cloudflare, Gemini, GeminiPro, Grok, DeepSeekAPI
13 13 from ..Provider import Microsoft_Phi_4_Multimodal, DeepInfraChat, Blackbox, OIVSCodeSer0501, OIVSCodeSer2, TeachAnything, OperaAria, Startnest
14 14 from ..Provider import WeWordle, Yqcloud, Chatai, ImageLabs, LegacyLMArena, LMArenaBeta, Free2GPT
15 15 from ..Provider import EdgeTTS, gTTS, MarkItDown, OpenAIFM
16 from ..Provider import HarProvider, HuggingFace, HuggingFaceMedia, Azure
16 from ..Provider import HarProvider, HuggingFace, HuggingFaceMedia, Azure, Qwen, EasyChat, GLM
17 17 from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
18 18 from .. import Provider
19 19 from .. import models
20 20 from .. import debug
21 21 from .any_model_map import audio_models, image_models, vision_models, video_models, model_map, models_count, parents, model_aliases
22 22
23 # Add all model aliases to the model map
23 24 PROVIERS_LIST_1 = [
24 25 CopilotAccount, OpenaiChat, Cloudflare, PerplexityLabs, Gemini, Grok, DeepSeekAPI, Blackbox, OpenAIFM,
25 26 OIVSCodeSer2, OIVSCodeSer0501, TeachAnything, WeWordle, Yqcloud, Chatai, Free2GPT, ImageLabs,
@@ -28,10 +29,12 @@ PROVIERS_LIST_1 = [
28 29 HuggingSpace, HuggingFace, HuggingFaceMedia, GeminiPro, PuterJS, OperaAria, Startnest
29 30 ]
30 31
32 # Add all existing models to the model map
31 33 PROVIERS_LIST_2 = [
32 OpenaiChat, Copilot, CopilotAccount, PollinationsAI, PerplexityLabs, Gemini, Grok, Azure
34 OpenaiChat, Copilot, CopilotAccount, PollinationsAI, PerplexityLabs, Gemini, Grok, Azure, Qwen, EasyChat, GLM
33 35 ]
34 36
37 # Add all models to the model map
35 38 PROVIERS_LIST_3 = [
36 39 HarProvider, LambdaChat, DeepInfraChat, HuggingFace, HuggingFaceMedia, LegacyLMArena, LMArenaBeta,
37 40 PuterJS, Cloudflare, HuggingSpace