Skip to content

Commit 03a73b0

Browse files
committed
feat(use-example): code optimize
1 parent 7c9ea2c commit 03a73b0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

main.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
from dotenv import dotenv_values
66

77

8-
class SkillsList:
8+
class IntentsList:
99
def __init__(self):
1010
"""
1111
The api of Gaud Open Platform is used here.
12+
1213
https://lbs.amap.com/api/webservice/guide/api/weatherinfo
1314
"""
1415
self.weather_api_url = "https://restapi.amap.com/v3/weather/weatherInfo"
@@ -103,6 +104,7 @@ def call_gpt(user_input):
103104
functions=function,
104105
function_call="auto",
105106
)
107+
106108
return completion.choices[0].message
107109

108110

@@ -112,9 +114,9 @@ def call_gpt(user_input):
112114
env = dotenv_values()
113115
openai.api_key = env['OPENAI_API_KEY']
114116

115-
skills_list_obj = SkillsList()
117+
intents_list_obj = IntentsList()
116118

117-
prompt = st.text_input("Enter your command:")
119+
prompt = st.text_input("Enter your prompt:")
118120

119121
if prompt:
120122
reply_content = call_gpt(prompt)
@@ -125,5 +127,5 @@ def call_gpt(user_input):
125127

126128
method_args_dict = json.loads(method_args)
127129

128-
method = getattr(skills_list_obj, method_name)
130+
method = getattr(intents_list_obj, method_name)
129131
method(**method_args_dict)

0 commit comments

Comments
 (0)