@@ -112,6 +112,7 @@ def call_gpt(user_input):
112
112
st .title ("Small assistant" )
113
113
114
114
env = dotenv_values ()
115
+
115
116
openai .api_key = env ['OPENAI_API_KEY' ]
116
117
117
118
intents_list_obj = IntentsList ()
@@ -122,10 +123,14 @@ def call_gpt(user_input):
122
123
reply_content = call_gpt (prompt )
123
124
124
125
reply_content_dict = reply_content .to_dict ()
125
- method_name = reply_content_dict ['function_call' ]['name' ]
126
- method_args = reply_content_dict ['function_call' ]['arguments' ]
127
126
128
- method_args_dict = json .loads (method_args )
127
+ if (reply_content_dict ['content' ]):
128
+ st .markdown (f"{ reply_content_dict ['content' ]} " )
129
+ else :
130
+ method_name = reply_content_dict ['function_call' ]['name' ]
131
+ method_args = reply_content_dict ['function_call' ]['arguments' ]
132
+
133
+ method_args_dict = json .loads (method_args )
129
134
130
- method = getattr (intents_list_obj , method_name )
131
- method (** method_args_dict )
135
+ method = getattr (intents_list_obj , method_name )
136
+ method (** method_args_dict )
0 commit comments