Added and updated repositories 2026-02-21 01:22:37

This commit is contained in:
github-actions[bot]
2026-02-21 01:22:37 +00:00
parent 392e33b019
commit 98e6966695
2 changed files with 31 additions and 6 deletions

View File

@@ -3,7 +3,7 @@
# This software is released under the MIT License. # This software is released under the MIT License.
# https://opensource.org/licenses/MIT # https://opensource.org/licenses/MIT
__version__ = (6, 1, 0) #фыр __version__ = (6, 1, 1) #  ̄へ ̄
# meta developer: @SenkoGuardianModules # meta developer: @SenkoGuardianModules
@@ -390,6 +390,10 @@ class Gemini(loader.Module):
openai_messages.append({"role": "user", "content": content_list}) openai_messages.append({"role": "user", "content": content_list})
target_model = self.config["model_name"] target_model = self.config["model_name"]
result_text = await self._send_to_Openrouter_api(target_model, openai_messages, self.config["temperature"]) result_text = await self._send_to_Openrouter_api(target_model, openai_messages, self.config["temperature"])
result_text = result_text.strip()
result_text = re.sub(r"^\[System Info:.*?\]\s*", "", result_text, flags=re.IGNORECASE)
result_text = re.sub(r"^\[\d{2}\.\d{2}\.\d{4} \d{2}:\d{2}\]\s*(?:Gemini:|Model:|Ассистент:|AI:)?\s*", "", result_text, flags=re.IGNORECASE)
result_text = re.sub(r"^\[\d{2}:\d{2}\]\s*(?:Gemini:|Model:|Ассистент:|AI:)?\s*", "", result_text, flags=re.IGNORECASE)
if self._is_memory_enabled(str(chat_id)): if self._is_memory_enabled(str(chat_id)):
self._update_history(history_key, current_turn_parts, result_text, regeneration, msg_obj, gauto=impersonation_mode) self._update_history(history_key, current_turn_parts, result_text, regeneration, msg_obj, gauto=impersonation_mode)
if impersonation_mode: return result_text if impersonation_mode: return result_text
@@ -447,8 +451,16 @@ class Gemini(loader.Module):
contents = [] contents = []
raw_hist = self._get_structured_history(chat_id, gauto=impersonation_mode) raw_hist = self._get_structured_history(chat_id, gauto=impersonation_mode)
if regeneration and raw_hist: raw_hist = raw_hist[:-2] if regeneration and raw_hist: raw_hist = raw_hist[:-2]
try:
user_tz = pytz.timezone(self.config["timezone"])
except pytz.UnknownTimeZoneError:
user_tz = pytz.utc
for item in raw_hist: for item in raw_hist:
contents.append(types.Content(role=item['role'], parts=[types.Part(text=item['content'])])) content_text = item.get('content', '')
if 'date' in item and item['date']:
dt = datetime.fromtimestamp(item['date'], user_tz)
content_text = f"[{dt.strftime('%d.%m.%Y %H:%M')}] {content_text}"
contents.append(types.Content(role=item['role'], parts=[types.Part(text=content_text)]))
request_parts = list(current_turn_parts) request_parts = list(current_turn_parts)
if not impersonation_mode: if not impersonation_mode:
try: user_timezone = pytz.timezone(self.config["timezone"]) try: user_timezone = pytz.timezone(self.config["timezone"])
@@ -488,6 +500,10 @@ class Gemini(loader.Module):
) )
if response.text: if response.text:
result_text = response.text result_text = response.text
result_text = result_text.strip()
result_text = re.sub(r"^\[System Info:.*?\]\s*", "", result_text, flags=re.IGNORECASE)
result_text = re.sub(r"^\[\d{2}\.\d{2}\.\d{4} \d{2}:\d{2}\]\s*(?:Gemini:|Model:|Ассистент:|AI:)?\s*", "", result_text, flags=re.IGNORECASE)
result_text = re.sub(r"^\[\d{2}:\d{2}\]\s*(?:Gemini:|Model:|Ассистент:|AI:)?\s*", "", result_text, flags=re.IGNORECASE)
was_successful = True was_successful = True
if self.config["google_search"]: search_icon = " 🌐" if self.config["google_search"]: search_icon = " 🌐"
self.current_api_key_index = current_idx self.current_api_key_index = current_idx
@@ -1103,7 +1119,8 @@ class Gemini(loader.Module):
header = data.get("header", "") header = data.get("header", "")
raw_text_chunk = chunks[page_num] raw_text_chunk = chunks[page_num]
safe_text = self._markdown_to_html(raw_text_chunk) safe_text = self._markdown_to_html(raw_text_chunk)
text_to_show = f"{header}<blockquote expandable>{safe_text}</blockquote>" formatted_body = self._format_response_with_smart_separation(safe_text)
text_to_show = f"{header}\n{formatted_body}"
nav_row = [] nav_row = []
if page_num > 0: if page_num > 0:
nav_row.append({"text": "◀️", "data": f"gemini:pg:{uid}:{page_num - 1}"}) nav_row.append({"text": "◀️", "data": f"gemini:pg:{uid}:{page_num - 1}"})
@@ -1563,12 +1580,20 @@ class Gemini(loader.Module):
messages = [] messages = []
if system_prompt: if system_prompt:
messages.append({"role": "system", "content": system_prompt}) messages.append({"role": "system", "content": system_prompt})
try:
user_tz = pytz.timezone(self.config["timezone"])
except:
user_tz = pytz.utc
for item in history: for item in history:
role = "assistant" if item['role'] == "model" else "user" role = "assistant" if item['role'] == "model" else "user"
content = item.get("content", "") content = item.get("content", "")
if 'date' in item and item['date']:
dt = datetime.fromtimestamp(item['date'], user_tz)
content = f"[{dt.strftime('%d.%m.%Y %H:%M')}] {content}"
messages.append({"role": role, "content": content}) messages.append({"role": role, "content": content})
return messages return messages
def _is_memory_enabled(self, chat_id: str) -> bool: return chat_id not in self.memory_disabled_chats def _is_memory_enabled(self, chat_id: str) -> bool: return chat_id not in self.memory_disabled_chats
def _disable_memory(self, chat_id: int): self.memory_disabled_chats.add(str(chat_id)) def _disable_memory(self, chat_id: int): self.memory_disabled_chats.add(str(chat_id))
def _enable_memory(self, chat_id: int): self.memory_disabled_chats.discard(str(chat_id)) def _enable_memory(self, chat_id: int): self.memory_disabled_chats.discard(str(chat_id))

View File

@@ -145,7 +145,7 @@ BBOX_IOS = (
) )
@loader.translatable_docstring @loader.tds
class Gradientor(loader.Module): class Gradientor(loader.Module):
strings = { strings = {
"name": "Gradientor", "name": "Gradientor",
@@ -376,7 +376,7 @@ class Gradientor(loader.Module):
return await utils.answer(message, self.strings["noargs"]) return await utils.answer(message, self.strings["noargs"])
args = args[0].split("/")[-1] args = args[0].split("/")[-1]
background_only = True background_only = False
try: try:
gift: UniqueStarGift = await self.client(GetUniqueStarGiftRequest(args)) gift: UniqueStarGift = await self.client(GetUniqueStarGiftRequest(args))