Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0eff1dc

Browse files
committed
feat(use-example): code optimize
1 parent e7e8e35 commit 0eff1dc

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

‎main.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,15 @@ def call_gpt(user_input):
124124

125125
reply_content_dict = reply_content.to_dict()
126126

127-
if (reply_content_dict['content']):
128-
st.markdown(f"{reply_content_dict['content']}")
127+
content = reply_content_dict['content']
128+
129+
if (content):
130+
st.markdown(f"{content}")
129131
else:
130-
method_name = reply_content_dict['function_call']['name']
131-
method_args = reply_content_dict['function_call']['arguments']
132+
function_call = reply_content_dict['function_call']
133+
134+
method_name = function_call['name']
135+
method_args = function_call['arguments']
132136

133137
method_args_dict = json.loads(method_args)
134138

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /