diff options
author | kqlio67 <kqlio67@users.noreply.github.com> | 2024-11-11 19:21:03 +0100 |
---|---|---|
committer | kqlio67 <kqlio67@users.noreply.github.com> | 2024-11-11 19:21:03 +0100 |
commit | 82b8c22b0b90590b7aae2685852910193a0f379d (patch) | |
tree | 720fb61b345f5c6dff761e7f7f87459b942f72bb /g4f/Provider/airforce | |
parent | feat(g4f/Provider/airforce/AirforceImage.py): Dynamically fetch image models from API (diff) | |
download | gpt4free-82b8c22b0b90590b7aae2685852910193a0f379d.tar gpt4free-82b8c22b0b90590b7aae2685852910193a0f379d.tar.gz gpt4free-82b8c22b0b90590b7aae2685852910193a0f379d.tar.bz2 gpt4free-82b8c22b0b90590b7aae2685852910193a0f379d.tar.lz gpt4free-82b8c22b0b90590b7aae2685852910193a0f379d.tar.xz gpt4free-82b8c22b0b90590b7aae2685852910193a0f379d.tar.zst gpt4free-82b8c22b0b90590b7aae2685852910193a0f379d.zip |
Diffstat (limited to 'g4f/Provider/airforce')
-rw-r--r-- | g4f/Provider/airforce/AirforceChat.py | 8 |
1 files changed, 6 insertions, 2 deletions
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)""" |