Change type msg_location to an Enum instead of Literal to be able to get all values easy and improve type checks.
This commit is contained in:
@@ -4,7 +4,7 @@ from pathlib import Path
|
||||
from itertools import zip_longest
|
||||
from copy import deepcopy
|
||||
from ..configuration import Config
|
||||
from ..chat import ChatDB
|
||||
from ..chat import ChatDB, msg_location
|
||||
from ..message import Message, MessageFilter, MessageError, Question, source_code
|
||||
from ..ai_factory import create_ai
|
||||
from ..ai import AI, AIResponse
|
||||
@@ -202,14 +202,14 @@ def question_cmd(args: argparse.Namespace, config: Config) -> None:
|
||||
repeat_msgs: list[Message] = []
|
||||
# repeat latest message
|
||||
if len(args.repeat) == 0:
|
||||
lmessage = chat.msg_latest(loc='cache')
|
||||
lmessage = chat.msg_latest(loc=msg_location.CACHE)
|
||||
if lmessage is None:
|
||||
print("No message found to repeat!")
|
||||
sys.exit(1)
|
||||
repeat_msgs.append(lmessage)
|
||||
# repeat given message(s)
|
||||
else:
|
||||
repeat_msgs = chat.msg_find(args.repeat, loc='disk')
|
||||
repeat_msgs = chat.msg_find(args.repeat, loc=msg_location.DISK)
|
||||
repeat_messages(repeat_msgs, chat, args, config)
|
||||
# === PROCESS ===
|
||||
elif args.process is not None:
|
||||
|
||||
Reference in New Issue
Block a user