1
1
from abc import ABC
2
- from typing import Dict
2
+ from typing import Callable , Dict
3
3
4
4
from modules .api .llm .groq import GroqCloudLLMProvider
5
5
from modules .api .llm .openai import OpenAILLMProvider
6
6
from modules .api .llm .textgen_webui import TextGenerationWebUILLMProvider
7
- from modules .commands .tts import TTSCommand
8
- from modules .commands .rcon import RconCommand
9
- from modules .commands .llm import CommandGlobalChatLLMChatCommand , CommandPrivateChatLLMChatCommand , \
10
- ConfirmableQuickQueryLLMCommand , QuickQueryLLMCommand
11
7
from modules .commands .decorators import (
12
8
admin_only ,
9
+ blacklist_factory ,
13
10
deny_empty_prompt ,
14
11
disabled ,
15
12
empty_prompt_message_response ,
16
13
openai_moderated ,
17
14
whitelist_factory ,
18
- blacklist_factory
19
15
)
20
- from modules .logs import get_logger
16
+ from modules .commands .llm import (
17
+ CommandGlobalChatLLMChatCommand ,
18
+ CommandPrivateChatLLMChatCommand ,
19
+ ConfirmableQuickQueryLLMCommand ,
20
+ QuickQueryLLMCommand ,
21
+ )
22
+ from modules .commands .rcon import RconCommand
23
+ from modules .commands .tts import TTSCommand
24
+ from modules .logs import gui_logger
21
25
from modules .typing import CommandSchemaDefinition
22
26
23
- main_logger = get_logger ("main" )
24
- gui_logger = get_logger ("gui" )
25
-
26
27
LLM_COMMAND_SETTINGS = {
27
28
"prompt-file" ,
28
29
"enable-soft-limit" ,
39
40
}
40
41
41
42
# Traits
42
- WRAPPERS = {
43
+ WRAPPERS : Dict [ str , Callable ] = {
43
44
"openai-moderated" : openai_moderated ,
44
45
"admin-only" : admin_only ,
45
46
"empty-prompt-message-response" : empty_prompt_message_response ,
46
47
"disabled" : disabled ,
47
48
"deny-empty-prompt" : deny_empty_prompt ,
48
49
"whitelist" : whitelist_factory ,
49
- "blacklist" : blacklist_factory
50
+ "blacklist" : blacklist_factory ,
50
51
}
51
52
52
53
LLM_PROVIDERS = {
@@ -62,7 +63,7 @@ class InvalidCommandException(Exception): ...
62
63
class Loader (ABC ):
63
64
def __init__ (self , raw_data : dict ) -> None :
64
65
self .raw_command_data = raw_data
65
- self .command_data = {}
66
+ self .command_data : Dict = {}
66
67
67
68
def get_data (self ) -> dict :
68
69
self .__load_settings ()
@@ -145,17 +146,13 @@ def __load_rcon_command(self):
145
146
klass = RconCommand , loader = RCONCommandLoader , settings = {"wait-ms" }
146
147
),
147
148
"openai-tts" : CommandSchemaDefinition (
148
- klass = TTSCommand , loader = Loader , settings = {
149
- "model" ,
150
- "voice" ,
151
- "speed" ,
152
- "volume" ,
153
- "output_device"
154
- }
149
+ klass = TTSCommand ,
150
+ loader = Loader ,
151
+ settings = {"model" , "voice" , "speed" , "volume" , "output_device" },
155
152
),
156
- ' confirmable-quick-query' : CommandSchemaDefinition (
153
+ " confirmable-quick-query" : CommandSchemaDefinition (
157
154
klass = ConfirmableQuickQueryLLMCommand ,
158
155
loader = LLMCommandLoader ,
159
- settings = LLM_COMMAND_SETTINGS
160
- )
156
+ settings = LLM_COMMAND_SETTINGS ,
157
+ ),
161
158
}
0 commit comments