Из конфига удалена температура модели (параметры пока будут задаваться в пресете OpenRouter).

This commit is contained in:
Kirill Kirilenko 2026-02-08 17:56:13 +03:00
parent a1e5d4d2e8
commit 2e7f2d0632
3 changed files with 4 additions and 8 deletions

View file

@ -30,14 +30,13 @@ class Message:
class AiAgent:
def __init__(self, api_token: str, model: str, model_temp: float, db: BasicDatabase):
def __init__(self, api_token: str, model: str, db: BasicDatabase):
retry_config = RetryConfig(strategy="backoff",
backoff=BackoffStrategy(
initial_interval=2000, max_interval=8000, exponent=2, max_elapsed_time=14000),
retry_connection_errors=True)
self.db = db
self.model = model
self.model_temp = model_temp
self.client = OpenRouter(api_key=api_token, retry_config=retry_config)
async def get_group_chat_reply(self, bot_id: int, chat_id: int,
@ -56,8 +55,7 @@ class AiAgent:
response = await self.client.chat.send_async(
model=self.model,
messages=context,
max_tokens=500,
temperature=self.model_temp
max_tokens=500
)
# Extract AI response
@ -136,6 +134,6 @@ class AiAgent:
agent: AiAgent
def create_ai_agent(api_token: str, model: str, model_temp: float, db: BasicDatabase):
def create_ai_agent(api_token: str, model: str, db: BasicDatabase):
global agent
agent = AiAgent(api_token, model, model_temp, db)
agent = AiAgent(api_token, model, db)

View file

@ -26,7 +26,6 @@ async def main() -> None:
create_ai_agent(config['openrouter_token'],
config['openrouter_model'],
config['openrouter_model_temp'],
database.DB)
bots: list[Bot] = []

View file

@ -26,7 +26,6 @@ if __name__ == '__main__':
create_ai_agent(config['openrouter_token'],
config['openrouter_model'],
config['openrouter_model_temp'],
database.DB)
bot = Bot(labeler=handlers.labeler)