feat: show AI progress and configure prompt directory
This commit is contained in:
@@ -4,7 +4,7 @@ import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
from unittest.mock import AsyncMock, MagicMock, call, patch
|
||||
|
||||
from app.agentic import (
|
||||
AgentSessionHandle,
|
||||
@@ -302,7 +302,7 @@ class AiCommandTests(unittest.IsolatedAsyncioTestCase):
|
||||
handle,
|
||||
ctx.reply.return_value,
|
||||
)
|
||||
ctx.message.react.assert_not_awaited()
|
||||
self.assertEqual(ctx.message.react.await_args_list, [call("🤔"), call(None)])
|
||||
|
||||
async def test_invalid_syntax_only_dislikes(self) -> None:
|
||||
ctx = self._ctx(".ds .th")
|
||||
@@ -310,7 +310,7 @@ class AiCommandTests(unittest.IsolatedAsyncioTestCase):
|
||||
with self.assertLogs("app.commands.builtins", level="ERROR"):
|
||||
await ai(ctx)
|
||||
|
||||
ctx.message.react.assert_awaited_once_with("👎")
|
||||
self.assertEqual(ctx.message.react.await_args_list, [call("🤔"), call("👎")])
|
||||
ctx.reply.assert_not_awaited()
|
||||
|
||||
async def test_agent_error_only_dislikes(self) -> None:
|
||||
@@ -322,9 +322,27 @@ class AiCommandTests(unittest.IsolatedAsyncioTestCase):
|
||||
with self.assertLogs("app.commands.builtins", level="ERROR"):
|
||||
await ai(ctx)
|
||||
|
||||
ctx.message.react.assert_awaited_once_with("👎")
|
||||
self.assertEqual(ctx.message.react.await_args_list, [call("🤔"), call("👎")])
|
||||
ctx.reply.assert_not_awaited()
|
||||
|
||||
async def test_thinking_reaction_failure_does_not_stop_ai(self) -> None:
|
||||
ctx = self._ctx()
|
||||
ctx.message.react.side_effect = [RuntimeError("reactions disabled"), None]
|
||||
|
||||
with (
|
||||
patch(
|
||||
"app.commands.builtins.run_agent_turn",
|
||||
AsyncMock(
|
||||
return_value=SimpleNamespace(answer="answer", handle=MagicMock())
|
||||
),
|
||||
),
|
||||
self.assertLogs("app.commands.builtins", level="ERROR"),
|
||||
):
|
||||
await ai(ctx)
|
||||
|
||||
ctx.reply.assert_awaited_once_with("answer")
|
||||
self.assertEqual(ctx.message.react.await_args_list, [call("🤔"), call(None)])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user