Changes from https://github.com/juk0de/ChatMastermind.git #1

Closed
ok wants to merge 176 commits from main into juk
Showing only changes of commit a7345cbc41 - Show all commits

View File

@ -17,7 +17,7 @@ def create_ai(args: argparse.Namespace, config: Config) -> AI: # noqa: 11
is not found, it uses the first AI in the list. is not found, it uses the first AI in the list.
""" """
ai_conf: AIConfig ai_conf: AIConfig
if 'AI' in args and args.AI: if hasattr(args, 'AI') and args.AI:
try: try:
ai_conf = config.ais[args.AI] ai_conf = config.ais[args.AI]
except KeyError: except KeyError:
@ -32,11 +32,11 @@ def create_ai(args: argparse.Namespace, config: Config) -> AI: # noqa: 11
if ai_conf.name == 'openai': if ai_conf.name == 'openai':
ai = OpenAI(cast(OpenAIConfig, ai_conf)) ai = OpenAI(cast(OpenAIConfig, ai_conf))
if 'model' in args and args.model: if hasattr(args, 'model') and args.model:
ai.config.model = args.model ai.config.model = args.model
if 'max_tokens' in args and args.max_tokens: if hasattr(args, 'max_tokens') and args.max_tokens:
ai.config.max_tokens = args.max_tokens ai.config.max_tokens = args.max_tokens
if 'temperature' in args and args.temperature: if hasattr(args, 'temperature') and args.temperature:
ai.config.temperature = args.temperature ai.config.temperature = args.temperature
return ai return ai
else: else: