1
1
from octo import Octo
2
- from octo import DESCRIPTION , VERSION , ASCII_ART
2
+ from octo import ASCII_ART
3
3
from octo import __version__
4
4
5
5
from rich .console import Console
@@ -59,55 +59,49 @@ def main():
59
59
except :
60
60
if args .command == "start" :
61
61
with console .status ("[bold green]Starting Mindsdb..." , spinner = "dots2" ):
62
- try :
63
62
octo .start_local ()
64
- except :
65
- rprint (
66
- "[bold][red]Error: Mindsdb is not installed. Use 'pip install mindsdb' to install."
67
- )
68
- return
69
- rprint (f"[bold][green]Started Mindsdb local server" )
63
+ console .print (f"[bold][green]Started Mindsdb local server" )
70
64
else :
71
- rprint (
65
+ console . print (
72
66
"[bold][red]Error: Mindsdb server is not running. Use 'octo start' to start the server."
73
67
)
74
68
return
75
69
76
70
if args .command == "stop" :
77
71
octo .stop_local ()
78
- rprint (f"[bold][green]Stopped Mindsdb local server" )
72
+ console . print (f"[bold][green]Stopped Mindsdb local server" )
79
73
80
74
if args .command == "init" :
81
75
try :
82
76
owner = args .repo .split ("/" )[0 ]
83
77
repo = args .repo .split ("/" )[1 ]
84
78
except :
85
- rprint (
79
+ console . print (
86
80
"[bold][red]Error: Invalid repository name, format should be 'owner/repo'"
87
81
)
88
82
return
89
83
with console .status ("[bold green]Initializing repository..." , spinner = "dots2" ):
90
- rprint (f"[bold][green] Creating model { owner } /{ repo } " )
84
+ console . print (f"[bold][green] Creating model { owner } /{ repo } " )
91
85
message = octo .init (repo , owner , args .branch , all_files = args .all )
92
- rprint (message )
86
+ console . print (message )
93
87
94
88
if args .command == "drop" :
95
89
try :
96
90
owner = args .repo .split ("/" )[0 ]
97
91
repo = args .repo .split ("/" )[1 ]
98
92
except :
99
- rprint (
93
+ console . print (
100
94
"[bold][red]Error: Invalid repository name, format should be 'owner/repo'"
101
95
)
102
96
return
103
97
project = octo ._get_project ()
104
98
model_names = [i .name for i in project .list_models ()]
105
99
if f"{ owner } _{ repo } " not in model_names :
106
- rprint (f"[bold][red]Error: Model { owner } /{ repo } does not exist" )
100
+ console . print (f"[bold][red]Error: Model { owner } /{ repo } does not exist" )
107
101
return
108
102
else :
109
103
project .drop_model (f"{ owner } _{ repo } " )
110
- rprint (f"[bold][green]Deleted model { owner } /{ repo } " )
104
+ console . print (f"[bold][green]Deleted model { owner } /{ repo } " )
111
105
112
106
if args .version :
113
107
text = ASCII_ART .format (__version__ )
@@ -123,11 +117,11 @@ def main():
123
117
)
124
118
return
125
119
message = octo .checkout (owner , repo )
126
- console .log (message )
120
+ console .print (message )
127
121
128
122
if args .command == "status" :
129
123
message = octo .status ()
130
- console .log (message )
124
+ console .print (message )
131
125
132
126
if args .command == "tell" :
133
127
df = pd .DataFrame ({"questions" : [args .action ]})
@@ -136,7 +130,8 @@ def main():
136
130
answer = pred_df ["answer" ].iloc [0 ]
137
131
# Filter string
138
132
answer = answer .replace ("\n " , "" )
139
- rprint (answer )
133
+ console .print (f"\n { answer } " )
134
+ return
140
135
141
136
if args .command == "drop" :
142
137
try :
@@ -148,15 +143,15 @@ def main():
148
143
)
149
144
return
150
145
message = octo .drop (owner , repo )
151
- rprint (message )
146
+ console . print (message )
152
147
153
148
if args .command == "list" :
154
149
model_names = octo .list_models ()
155
150
# Format the string
156
151
model_names = [i .replace ("_" , "/" ) for i in model_names ]
157
152
with console .status ("[bold green]Fetching models..." , spinner = "dots2" ):
158
153
for i in model_names :
159
- rprint (i )
154
+ console . print (i )
160
155
161
156
162
157
0 commit comments