ShipBit/wingman-ai

On dev wingman, not having remember messages in config.yaml throws error

Closed this issue · 1 comments

INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
Recording started (nms)
Recording stopped (nms)
Hey, look at this. What do you think I should do here?
Exception in thread Thread-2 (run_async_process):
Traceback (most recent call last):
  File "C:\Users\Willi\anaconda3\envs\wingman\Lib\threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "C:\Users\Willi\anaconda3\envs\wingman\Lib\threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\Willi\Documents\GitHub\wingman-ai\wingman_core.py", line 163, in run_async_process
    loop.run_until_complete(
  File "C:\Users\Willi\anaconda3\envs\wingman\Lib\asyncio\base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\Users\Willi\Documents\GitHub\wingman-ai\wingmen\wingman.py", line 208, in process
    process_result, instant_response = await self._get_response_for_transcript(
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Willi\Documents\GitHub\wingman-ai\wingmen\open_ai_wingman.py", line 213, in _get_response_for_transcript
    self._add_user_message(transcript)
  File "C:\Users\Willi\Documents\GitHub\wingman-ai\wingmen\open_ai_wingman.py", line 389, in _add_user_message
    self._cleanup_conversation_history()
  File "C:\Users\Willi\Documents\GitHub\wingman-ai\wingmen\open_ai_wingman.py", line 394, in _cleanup_conversation_history
    remember_messages = self.config.features.remember_messages - 1
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'

I'm not sure of the exact architecture here but I think either: (a) a default has to be set for config.features.remember_messages if the variable is not set by the user or openai-wingman.py at line 394 needs to check if config.features.remember_messages is None before doing anything, if so, return 0 before any other calculations.

fixed in #104, thank you