Skip to content

Commit

Permalink
Format Python code with psf/black push
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions authored and github-actions committed Nov 17, 2023
1 parent b84b62a commit 2b7a902
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
13 changes: 9 additions & 4 deletions models/openai_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,9 @@ async def send_chatgpt_chat_request(
messages.append(
{
"role": role,
"name": username_clean if role == "user" else bot_name_clean,
"name": username_clean
if role == "user"
else bot_name_clean,
"content": text,
}
)
Expand All @@ -1012,7 +1014,9 @@ async def send_chatgpt_chat_request(
messages.append(
{
"role": role,
"name": username_clean if role == "user" else bot_name_clean,
"name": username_clean
if role == "user"
else bot_name_clean,
"content": [
{"type": "text", "text": text},
],
Expand All @@ -1028,7 +1032,9 @@ async def send_chatgpt_chat_request(
messages.append(
{
"role": role,
"name": username_clean if role == "user" else bot_name_clean,
"name": username_clean
if role == "user"
else bot_name_clean,
"content": [
{"type": "text", "text": text},
],
Expand Down Expand Up @@ -1097,7 +1103,6 @@ async def send_chatgpt_chat_request(
except Exception:
raise ValueError("Could not decode JSON response from the API")


return response

@backoff.on_exception(
Expand Down
12 changes: 9 additions & 3 deletions services/text_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,9 @@ async def process_conversation_message(
"""
last_messages = converser_cog.conversation_threads[
message.channel.id
].history[-6:] # Get the last 6 messages to determine context on whether we should draw
].history[
-6:
] # Get the last 6 messages to determine context on whether we should draw
last_messages = last_messages[1:]
try:
thinking_message = await TextService.trigger_thinking(message)
Expand All @@ -927,7 +929,9 @@ async def process_conversation_message(
await TextService.stop_thinking(thinking_message)
# This validation is only until we figure out what's wrong with the json response mode for vision.
if response_json["intent_to_draw"]:
thinking_message = await TextService.trigger_thinking(message,is_drawing=True)
thinking_message = await TextService.trigger_thinking(
message, is_drawing=True
)

links = await converser_cog.model.send_image_request_within_conversation(
response_json["prompt"],
Expand All @@ -954,7 +958,9 @@ async def process_conversation_message(
)
except:
try:
await message.reply("I encountered an error while trying to draw..")
await message.reply(
"I encountered an error while trying to draw.."
)
await thinking_message.delete()
converser_cog.conversation_threads[
message.channel.id
Expand Down

0 comments on commit 2b7a902

Please sign in to comment.