Skip to content

Commit 324e957

Browse files
committed
chat: improved API key settings
1 parent f99b4a8 commit 324e957

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

MAVProxy/modules/mavproxy_chat/chat_voice_to_text.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ def __init__(self):
1919
self.client = None
2020
self.assistant = None
2121

22+
# set the OpenAI API key
23+
def set_api_key(self, api_key_str):
24+
self.client = OpenAI(api_key = api_key_str)
25+
2226
# check connection to OpenAI assistant and connect if necessary
2327
# returns True if connection is good, False if not
2428
def check_connection(self):

MAVProxy/modules/mavproxy_chat/chat_window.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ def menu_set_api_key_show(self, event):
9696
# set API key set button clicked
9797
def apikey_set_button_click(self, event):
9898
self.chat_openai.set_api_key(self.apikey_text_input.GetValue())
99+
self.chat_voice_to_text.set_api_key(self.apikey_text_input.GetValue())
99100
self.apikey_frame.Hide()
100101

101102
# API key close button clicked

0 commit comments

Comments
 (0)