Refactor OpenAI model settings, enhance trigger keywords, and add reset/undo tests
This commit is contained in:
parent
195ca21947
commit
90ce504dbb
4 changed files with 6 additions and 9 deletions
6
main.py
6
main.py
|
|
@ -73,11 +73,11 @@ class BotDependencies:
|
||||||
web_search_results: ollama.WebSearchResponse | None = None
|
web_search_results: ollama.WebSearchResponse | None = None
|
||||||
|
|
||||||
|
|
||||||
openai_settings = OpenAIResponsesModelSettings(
|
openai_settings: OpenAIResponsesModelSettings = OpenAIResponsesModelSettings(
|
||||||
openai_text_verbosity="low",
|
openai_text_verbosity="low",
|
||||||
)
|
)
|
||||||
chatgpt_agent: Agent[BotDependencies, str] = Agent(
|
chatgpt_agent: Agent[BotDependencies, str] = Agent(
|
||||||
model="gpt-5-chat-latest",
|
model="openai:gpt-5-chat-latest",
|
||||||
deps_type=BotDependencies,
|
deps_type=BotDependencies,
|
||||||
model_settings=openai_settings,
|
model_settings=openai_settings,
|
||||||
)
|
)
|
||||||
|
|
@ -677,7 +677,7 @@ class LoviBotClient(discord.Client):
|
||||||
add_message_to_memory(str(message.channel.id), message.author.name, incoming_message)
|
add_message_to_memory(str(message.channel.id), message.author.name, incoming_message)
|
||||||
|
|
||||||
lowercase_message: str = incoming_message.lower()
|
lowercase_message: str = incoming_message.lower()
|
||||||
trigger_keywords: list[str] = ["lovibot", "@lovibot", "<@345000831499894795>"]
|
trigger_keywords: list[str] = ["lovibot", "@lovibot", "<@345000831499894795>", "@grok", "grok"]
|
||||||
has_trigger_keyword: bool = any(trigger in lowercase_message for trigger in trigger_keywords)
|
has_trigger_keyword: bool = any(trigger in lowercase_message for trigger in trigger_keywords)
|
||||||
should_respond_flag: bool = has_trigger_keyword or should_respond_without_trigger(str(message.channel.id), message.author.name)
|
should_respond_flag: bool = has_trigger_keyword or should_respond_without_trigger(str(message.channel.id), message.author.name)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@ dependencies = [
|
||||||
"sentry-sdk",
|
"sentry-sdk",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[dependency-groups]
|
||||||
|
dev = ["pytest", "ruff"]
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
preview = true
|
preview = true
|
||||||
fix = true
|
fix = true
|
||||||
|
|
@ -77,9 +80,3 @@ log_cli_level = "INFO"
|
||||||
log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)"
|
log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)"
|
||||||
log_cli_date_format = "%Y-%m-%d %H:%M:%S"
|
log_cli_date_format = "%Y-%m-%d %H:%M:%S"
|
||||||
python_files = "test_*.py *_test.py *_tests.py"
|
python_files = "test_*.py *_test.py *_tests.py"
|
||||||
|
|
||||||
[dependency-groups]
|
|
||||||
dev = [
|
|
||||||
"pytest>=9.0.1",
|
|
||||||
"ruff>=0.14.7",
|
|
||||||
]
|
|
||||||
|
|
|
||||||
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
Loading…
Add table
Add a link
Reference in a new issue