Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Add 'RECV_POST' after sending message. #125

Merged
merged 6 commits into from
Jul 1, 2023
Merged

Conversation

tic-top
Copy link
Contributor

@tic-top tic-top commented Jun 22, 2023

Details are shown in #118
In new_poe.py, I change generate_payload, send_query, send_message function. (I just add 'RECV_POST' in the send_message function)
In test.py, 600 samples, 1s interval.

Copy link
Owner

@ading2210 ading2210 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The entire file was converted from 2 spaces to 4. Please revert this.

import logging

poe.logger.setLevel(logging.INFO)
client = poe.Client("SqX7oTPz0qV1GKgkLEsCmA%3D%3D")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't hardcode your Poe token here.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lmao

import time

request = 300
wait_time = 600 / request
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, it'd be better to add the wait functionality to examples/repeated_messages.py instead of creating a new file.

examples/poe.py Outdated
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this a completely new file instead of editing the original poe-api/src/poe.py?

@tic-top
Copy link
Contributor Author

tic-top commented Jun 28, 2023

To ensure a smooth merging process, it is necessary to have a test beforehand.

self.request_count += 1

# send recv_post after receiving the last message
if self.request_count % 3 == 0:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this is a 1/3 chance even though the regular Poe web client sends a receive_POST after every message.

@@ -518,6 +550,27 @@ def send_message(self, chatbot, message, with_chat_break=False, timeout=20):
message_id = message["messageId"]

yield message

# wait 2 senconds after sending the request
time.sleep(2)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems kind of pointless to make all the waiting in this function be blocking. This could easily be moved to a new thread. I'll probably implement that on my own though.

@ading2210 ading2210 merged commit c10b42d into ading2210:main Jul 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants