From 82b8c22b0b90590b7aae2685852910193a0f379d Mon Sep 17 00:00:00 2001 From: kqlio67 Date: Mon, 11 Nov 2024 20:21:03 +0200 Subject: Update (g4f/models.py g4f/Provider/airforce/AirforceChat.py docs/providers-and-models.md) --- g4f/Provider/Airforce.py | 2 +- g4f/Provider/airforce/AirforceChat.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'g4f/Provider') diff --git a/g4f/Provider/Airforce.py b/g4f/Provider/Airforce.py index 8ea0a174..c7ae44c0 100644 --- a/g4f/Provider/Airforce.py +++ b/g4f/Provider/Airforce.py @@ -20,7 +20,7 @@ class Airforce(AsyncGeneratorProvider, ProviderModelMixin): supports_message_history = AirforceChat.supports_message_history default_model = AirforceChat.default_model - models = [*AirforceChat.text_models, *AirforceImage.image_models] + models = [*AirforceChat.models, *AirforceImage.models] model_aliases = { **AirforceChat.model_aliases, diff --git a/g4f/Provider/airforce/AirforceChat.py b/g4f/Provider/airforce/AirforceChat.py index fc375270..cec911a3 100644 --- a/g4f/Provider/airforce/AirforceChat.py +++ b/g4f/Provider/airforce/AirforceChat.py @@ -1,8 +1,8 @@ from __future__ import annotations import re import json -from aiohttp import ClientSession import requests +from aiohttp import ClientSession from typing import List from ...typing import AsyncResult, Messages @@ -21,7 +21,11 @@ def clean_response(text: str) -> str: ] for pattern in patterns: text = re.sub(pattern, '', text) - return text.strip() + + # Remove the <|im_end|> token if present + text = text.replace("<|im_end|>", "").strip() + + return text def split_message(message: str, max_length: int = 1000) -> List[str]: """Splits the message into chunks of a given length (max_length)""" -- cgit v1.2.3