minor fixes on manage.sh

This commit is contained in:
Alihan
2023-05-19 03:22:49 +03:00
parent df71413ad2
commit 322a061ede
2 changed files with 6 additions and 4 deletions

View File

@@ -10,7 +10,8 @@ from brain.brain_openai import CloudChatBrain
def brain_commander(prompt, history):
brain.listen(channel="api", prompt=prompt)
brain.understand()
if not brain.is_emergency(brain.cmd_prompt):
brain.understand()
history.append({"role": "user", "content": prompt})
history.append({"role": "assistant", "content": brain.answer})
messages = [(history[i]["content"], history[i+1]["content"]) for i in range(0, len(history)-1, 2)]
@@ -30,7 +31,6 @@ with gr.Blocks() as demo:
placeholder="Enter flight command and press enter")\
.style(container=True)
prompt.submit(brain_commander, [prompt, state], [chatbot_ui, state])
prompt.click(lambda x: gr.update(value=""), None, [""], queue=False)
demo.launch(server_name="0.0.0.0", server_port=8890, debug=True, )

View File

@@ -179,12 +179,12 @@ elif [ "$1" == "start-webui" ]; then
start_webui_service $2 > logs/webui.log 2>&1 &
webui_pid=$!
echo "started webui service with PID $webui_pid"
echo webui_pid > $pids_dir/webui_pid.txt
echo $webui_pid > $pids_dir/webui_pid.txt
elif [ "$1" == "stop-webui" ]; then
webui_pid_file="$pids_dir/webui_pid.txt"
if [ -f "webui_pid_file" ]; then
sudo pkill -15 -P $(cat webui_pid_file)
sudo pkill -15 -P $(cat $webui_pid_file)
sudo killport 8890
echo "stopped webui service"
fi
@@ -193,6 +193,7 @@ elif [ "$1" == "prepare-flight" ]; then
./manage.sh connect-drone
./manage.sh get-dhcp
./manage.sh start-commander
./manage.sh start-webui
echo "prepared to flight"
elif [ "$1" == "finish-flight" ]; then
@@ -201,6 +202,7 @@ elif [ "$1" == "finish-flight" ]; then
./manage.sh stop-commander
kill_everything
echo "flight finished"
elif [ "$1" == "start-clitalk" ]; then
talk_to_drone_via_cli $2