Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change repost action to align with twitter Recsys #31

Merged
merged 2 commits into from
Jan 16, 2025
Merged

Conversation

yiyiyi0817
Copy link
Member

After discussing with @Redtides0 , I modified some details of the repost action implementation and default field in database to make it more compatible with Twitter's recommendation algorithm.

@yiyiyi0817 yiyiyi0817 requested a review from Redtides0 January 16, 2025 14:36
@yiyiyi0817 yiyiyi0817 self-assigned this Jan 16, 2025
@yiyiyi0817 yiyiyi0817 added the enhancement New feature or request label Jan 16, 2025
Copy link
Contributor

@Redtides0 Redtides0 left a comment

Choose a reason for hiding this comment

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

when you quote_post, checking post_type is also needed.

@@ -428,8 +429,8 @@ async def repost(self, agent_id: int, post_id: int):
}

post_type_result = self.pl_utils._get_post_type(post_id)
post_insert_query = ("INSERT INTO post (user_id, original_post_id)"
"VALUES (?, ?)")
post_insert_query = ("INSERT INTO post (user_id, original_post_id"
Copy link
Contributor

Choose a reason for hiding this comment

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

OK, the current_time is added, what would post["content"] be ? "None"?

@@ -4,7 +4,7 @@ CREATE TABLE post (
post_id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER,
original_post_id INTEGER, -- NULL if this is an original post
content TEXT,
content TEXT DEFAULT '', -- DEFAULT '' for initial posts
Copy link
Member Author

Choose a reason for hiding this comment

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

@Redtides0 I changed the default value of content as a empty string. I think this might be a more convenient way to implementat it? WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

understood, LGTM.

@yiyiyi0817
Copy link
Member Author

yiyiyi0817 commented Jan 16, 2025

when you quote_post, checking post_type is also needed.

In the current main branch code, there is already a discussion on the classification of post types, so I did not modify the quote_post function in this PR. The current logic is that common posts will be directly quoted, while reposted and quoted posts will be quoted to the root post, just like the real Twitter.
And maybe we can also check each other again to ensure the robustness of the code.

@Redtides0
Copy link
Contributor

when you quote_post, checking post_type is also needed.

In the current main branch code, there is already a discussion on the classification of post types, so I did not modify the quote_post function in this PR. The current logic is that common posts will be directly quoted, while reposted and quoted posts will be quoted to the root post, just like the real Twitter. And maybe we can also check each other again to ensure the robustness of the code.

Ahh, my apologies for the initial oversight. After a more thorough review, I can confirm that everything is now in order.

@Redtides0 Redtides0 merged commit bbd3188 into main Jan 16, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants