Rename command/basic/documentation.py to command/basic/basic_commands.py
Browse files
command/basic/basic_commands.py
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import logging
|
3 |
+
|
4 |
+
import streamlit as st
|
5 |
+
|
6 |
+
from typing import Optional, Dict, Any
|
7 |
+
from ..command_interface import CommandInterface
|
8 |
+
|
9 |
+
|
10 |
+
class Documentation(CommandInterface):
|
11 |
+
def __init__(self,
|
12 |
+
command_file: str,
|
13 |
+
commands: Optional[str],
|
14 |
+
llm: Any,
|
15 |
+
id: int):
|
16 |
+
|
17 |
+
self.command_file = command_file
|
18 |
+
|
19 |
+
if commands is not None:
|
20 |
+
self.commands = commands
|
21 |
+
else:
|
22 |
+
self.commands = []
|
23 |
+
|
24 |
+
self.llm = llm
|
25 |
+
|
26 |
+
self.id = id
|
27 |
+
|
28 |
+
def get_command() -> Dict[str, Dict[str, list]]:
|
29 |
+
|
30 |
+
pass
|
31 |
+
|
32 |
+
def is_contains(commands: Optional[str], llm: Any, id: Any, command: Dict[str, Dict[str, list]]) -> bool:
|
33 |
+
|
34 |
+
pass
|
35 |
+
|
36 |
+
def execute() -> Any:
|
37 |
+
pass
|
command/basic/documentation.py
DELETED
@@ -1,31 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
import logging
|
3 |
-
|
4 |
-
import streamlit as st
|
5 |
-
from ..utils.form_documentation import generate_doc
|
6 |
-
|
7 |
-
from typing import Optional
|
8 |
-
from ..command_handler import CommandHandler
|
9 |
-
|
10 |
-
|
11 |
-
class DocumentationHandler(CommandHandler):
|
12 |
-
def __init__(self, commands, successor: Optional["CommandHandler"] = None):
|
13 |
-
super().__init__(successor)
|
14 |
-
self.commands = commands
|
15 |
-
|
16 |
-
def handle_command(self, command):
|
17 |
-
if command.lower() in self.commands:
|
18 |
-
self.execute_command()
|
19 |
-
else:
|
20 |
-
super().handle_command(command)
|
21 |
-
|
22 |
-
def execute_command(self):
|
23 |
-
current_dir = os.path.dirname(os.path.realpath(__file__))
|
24 |
-
path_to_file = generate_doc(path=current_dir)
|
25 |
-
|
26 |
-
if path_to_file is not None:
|
27 |
-
with st.sidebar:
|
28 |
-
st.download_button('Download doc', path_to_file)
|
29 |
-
st.success("Done", icon="✅")
|
30 |
-
else:
|
31 |
-
logging.error("path_to_file is None")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|