PR #35 - Update Old Weibo Tasks and Add New Ones
#35
by
dzakaathif
- opened
- rewards/weibo.py +949 -54
- tasks/weibo/accept-search-suggestion.json +0 -0
- tasks/weibo/change-search-categories.json +0 -0
- tasks/weibo/change-trending-tab-and-navigate.json +0 -0
- tasks/weibo/create-comment-with-expressions-on-detail.json +0 -0
- tasks/weibo/create-comment-with-inline-section.json +0 -0
- tasks/weibo/create-custom-group-and-navigate.json +0 -0
- tasks/weibo/create-post-with-expressions.json +0 -0
- tasks/weibo/delete-custom-group.json +0 -0
- tasks/weibo/edit-custom-group-name.json +0 -0
- tasks/weibo/follow-and-set-special-attention-flow.json +0 -0
- tasks/weibo/follow-and-unfollow-from-profile.json +0 -0
- tasks/weibo/follow-assign-to-group-and-navigate.json +0 -0
- tasks/weibo/follow-create-group-and-assign-flow.json +0 -0
- tasks/weibo/follow-user-and-check-latest-feed.json +0 -0
- tasks/weibo/home-from-search.json +0 -0
- tasks/weibo/like-post-from-main-feed.json +0 -0
- tasks/weibo/load-many-posts.json +0 -0
- tasks/weibo/load-more-posts.json +0 -0
- tasks/weibo/navigate-post.json +0 -0
- tasks/weibo/navigate-profile.json +0 -0
- tasks/weibo/navigate-to-empty-latest-feed.json +0 -0
- tasks/weibo/navigate-via-trending-topic.json +0 -0
- tasks/weibo/no-search-suggestions.json +0 -0
- tasks/weibo/open-inline-comments-section.json +0 -0
- tasks/weibo/open-post-composer-more-dropdown.json +0 -0
- tasks/weibo/partial-search-query.json +0 -0
- tasks/weibo/post-from-profile.json +0 -0
- tasks/weibo/post-from-search.json +0 -0
- tasks/weibo/profile-from-comments.json +0 -0
- tasks/weibo/profile-from-post.json +0 -0
- tasks/weibo/profile-from-reply.json +0 -0
- tasks/weibo/profile-from-search.json +0 -0
- tasks/weibo/profile-from-sorted-comments.json +0 -0
- tasks/weibo/search-dropdown-profile.json +0 -0
- tasks/weibo/search-follow-last-user.json +0 -0
- tasks/weibo/search-users.json +0 -0
- tasks/weibo/switch-theme.json +0 -0
- tasks/weibo/unassign-special-attention-and-groups.json +0 -0
- tasks/weibo/unlike-all-posts-on-profile.json +0 -0
- tasks/weibo/video-post-from-profile.json +0 -0
rewards/weibo.py
CHANGED
|
@@ -3,7 +3,7 @@ Reward functions for Weibo app tasks.
|
|
| 3 |
"""
|
| 4 |
|
| 5 |
import logging
|
| 6 |
-
from typing import Any, Dict, Tuple
|
| 7 |
|
| 8 |
logger = logging.getLogger(__name__)
|
| 9 |
|
|
@@ -51,7 +51,8 @@ def _validate_navigatepost(initial_state: Dict[str, Any], final_state: Dict[str,
|
|
| 51 |
This function validates the final state matches the expected target state:
|
| 52 |
- currentView should be "post"
|
| 53 |
- viewedPostId should match the expected post ID
|
| 54 |
-
-
|
|
|
|
| 55 |
|
| 56 |
Args:
|
| 57 |
initial_state: The initial state before navigation
|
|
@@ -67,17 +68,30 @@ def _validate_navigatepost(initial_state: Dict[str, Any], final_state: Dict[str,
|
|
| 67 |
if current_view != "post":
|
| 68 |
return 0.0, f"Not on post detail page, current view: {current_view}"
|
| 69 |
|
| 70 |
-
# Check 2: viewedPostId
|
| 71 |
viewed_post_id = final_state.get("viewedPostId")
|
| 72 |
-
if viewed_post_id
|
| 73 |
-
return 0.0,
|
| 74 |
|
| 75 |
-
# Check 3:
|
| 76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
if comment_tab != "hot":
|
| 78 |
-
return 0.0, f"Expected
|
| 79 |
|
| 80 |
-
return 1.0, "Successfully navigated to post
|
| 81 |
|
| 82 |
|
| 83 |
def _validate_loadmoreposts(initial_state: Dict[str, Any], final_state: Dict[str, Any]) -> Tuple[float, str]:
|
|
@@ -86,7 +100,7 @@ def _validate_loadmoreposts(initial_state: Dict[str, Any], final_state: Dict[str
|
|
| 86 |
|
| 87 |
This function validates the final state matches the expected target state:
|
| 88 |
- currentView should remain "feed"
|
| 89 |
-
-
|
| 90 |
- isLoadingPosts should be False (loading completed)
|
| 91 |
|
| 92 |
Args:
|
|
@@ -103,9 +117,9 @@ def _validate_loadmoreposts(initial_state: Dict[str, Any], final_state: Dict[str
|
|
| 103 |
if current_view != "feed":
|
| 104 |
return 0.0, f"Not on feed page, current view: {current_view}"
|
| 105 |
|
| 106 |
-
# Check 2:
|
| 107 |
-
initial_posts = initial_state.get("
|
| 108 |
-
final_posts = final_state.get("
|
| 109 |
|
| 110 |
initial_count = len(initial_posts)
|
| 111 |
final_count = len(final_posts)
|
|
@@ -113,11 +127,7 @@ def _validate_loadmoreposts(initial_state: Dict[str, Any], final_state: Dict[str
|
|
| 113 |
if final_count <= initial_count:
|
| 114 |
return 0.0, f"Posts did not increase: {initial_count} -> {final_count} (expected increase)"
|
| 115 |
|
| 116 |
-
# Check 3:
|
| 117 |
-
if final_count != 30:
|
| 118 |
-
return 0.0, f"Expected 30 posts in final state, got {final_count}"
|
| 119 |
-
|
| 120 |
-
# Check 4: isLoadingPosts should be False (loading completed)
|
| 121 |
is_loading = final_state.get("isLoadingPosts")
|
| 122 |
if is_loading:
|
| 123 |
return 0.0, f"Expected isLoadingPosts to be False after loading, got {is_loading}"
|
|
@@ -132,9 +142,10 @@ def _validate_postfromprofile(initial_state: Dict[str, Any], final_state: Dict[s
|
|
| 132 |
This function validates the final state matches the expected target state:
|
| 133 |
- currentView should be "post"
|
| 134 |
- viewedPostId should match the expected post ID (31)
|
| 135 |
-
-
|
| 136 |
- viewedUserId should be None (cleared when navigating to post detail)
|
| 137 |
-
-
|
|
|
|
| 138 |
|
| 139 |
Args:
|
| 140 |
initial_state: The initial state before navigation
|
|
@@ -150,32 +161,45 @@ def _validate_postfromprofile(initial_state: Dict[str, Any], final_state: Dict[s
|
|
| 150 |
if current_view != "post":
|
| 151 |
return 0.0, f"Not on post detail page, current view: {current_view}"
|
| 152 |
|
| 153 |
-
# Check 2: viewedPostId
|
| 154 |
viewed_post_id = final_state.get("viewedPostId")
|
| 155 |
-
if viewed_post_id
|
| 156 |
-
return 0.0,
|
| 157 |
|
| 158 |
-
# Check 3:
|
| 159 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
if comment_tab != "hot":
|
| 161 |
-
return 0.0, f"Expected
|
| 162 |
|
| 163 |
-
# Check
|
| 164 |
viewed_user_id = final_state.get("viewedUserId")
|
| 165 |
if viewed_user_id is not None:
|
| 166 |
return 0.0, f"Expected viewedUserId to be None after navigating to post, got '{viewed_user_id}'"
|
| 167 |
|
| 168 |
-
# Check
|
| 169 |
-
|
| 170 |
-
|
| 171 |
|
| 172 |
-
initial_count = len(
|
| 173 |
-
final_count = len(
|
| 174 |
|
| 175 |
if initial_count != final_count:
|
| 176 |
-
return 0.0, f"
|
| 177 |
|
| 178 |
-
return 1.0, "Successfully navigated to post
|
| 179 |
|
| 180 |
|
| 181 |
def _validate_partialsearchquery(initial_state: Dict[str, Any], final_state: Dict[str, Any]) -> Tuple[float, str]:
|
|
@@ -389,10 +413,11 @@ def _validate_postfromsearch(initial_state: Dict[str, Any], final_state: Dict[st
|
|
| 389 |
|
| 390 |
This function validates the final state matches the expected target state:
|
| 391 |
- currentView should be "post"
|
| 392 |
-
- viewedPostId should match the expected post ID
|
| 393 |
-
-
|
| 394 |
- searchQuery should be empty (cleared after navigation)
|
| 395 |
- viewedUserId should be None (cleared when navigating to post detail)
|
|
|
|
| 396 |
|
| 397 |
Args:
|
| 398 |
initial_state: The initial state before navigation (on search results page)
|
|
@@ -408,27 +433,46 @@ def _validate_postfromsearch(initial_state: Dict[str, Any], final_state: Dict[st
|
|
| 408 |
if current_view != "post":
|
| 409 |
return 0.0, f"Not on post detail page, current view: {current_view}"
|
| 410 |
|
| 411 |
-
# Check 2: viewedPostId
|
| 412 |
viewed_post_id = final_state.get("viewedPostId")
|
| 413 |
-
if viewed_post_id
|
| 414 |
-
return 0.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 415 |
|
| 416 |
-
|
| 417 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 418 |
if comment_tab != "hot":
|
| 419 |
-
return 0.0, f"Expected
|
| 420 |
|
| 421 |
-
# Check
|
| 422 |
search_query = final_state.get("searchQuery")
|
| 423 |
if search_query != "":
|
| 424 |
return 0.0, f"Expected searchQuery to be empty after navigation, got '{search_query}'"
|
| 425 |
|
| 426 |
-
# Check
|
| 427 |
viewed_user_id = final_state.get("viewedUserId")
|
| 428 |
if viewed_user_id is not None:
|
| 429 |
return 0.0, f"Expected viewedUserId to be None after navigating to post, got '{viewed_user_id}'"
|
| 430 |
|
| 431 |
-
return 1.0, "Successfully navigated to post
|
| 432 |
|
| 433 |
|
| 434 |
def _validate_acceptsearchsuggestion(initial_state: Dict[str, Any], final_state: Dict[str, Any]) -> Tuple[float, str]:
|
|
@@ -608,7 +652,7 @@ def _validate_loadmanyposts(initial_state: Dict[str, Any], final_state: Dict[str
|
|
| 608 |
This function validates the final state matches the expected target state:
|
| 609 |
- currentView should be "post"
|
| 610 |
- viewedPostId should match the expected post ID (23)
|
| 611 |
-
-
|
| 612 |
- The post should be from user "读书笔记"
|
| 613 |
- The post should have exactly 3 attachments (media items)
|
| 614 |
|
|
@@ -631,10 +675,10 @@ def _validate_loadmanyposts(initial_state: Dict[str, Any], final_state: Dict[str
|
|
| 631 |
if viewed_post_id != "23":
|
| 632 |
return 0.0, f"Expected viewedPostId to be '23', got '{viewed_post_id}'"
|
| 633 |
|
| 634 |
-
# Check 3:
|
| 635 |
-
comment_tab = final_state.get("
|
| 636 |
if comment_tab != "hot":
|
| 637 |
-
return 0.0, f"Expected
|
| 638 |
|
| 639 |
# Check 4: Find the post in allPosts and validate user name and attachments
|
| 640 |
all_posts = final_state.get("allPosts", [])
|
|
@@ -761,7 +805,7 @@ def _validate_videopostfromprofile(initial_state: Dict[str, Any], final_state: D
|
|
| 761 |
This function validates the final state matches the expected target state:
|
| 762 |
- currentView should be "post"
|
| 763 |
- viewedPostId should match the expected post ID (23)
|
| 764 |
-
-
|
| 765 |
- The post should be from user "读书笔记"
|
| 766 |
- The post should have at least one video attachment (media item with type "video")
|
| 767 |
|
|
@@ -784,10 +828,10 @@ def _validate_videopostfromprofile(initial_state: Dict[str, Any], final_state: D
|
|
| 784 |
if viewed_post_id != "23":
|
| 785 |
return 0.0, f"Expected viewedPostId to be '23', got '{viewed_post_id}'"
|
| 786 |
|
| 787 |
-
# Check 3:
|
| 788 |
-
comment_tab = final_state.get("
|
| 789 |
if comment_tab != "hot":
|
| 790 |
-
return 0.0, f"Expected
|
| 791 |
|
| 792 |
# Check 4: Find the post in allPosts and validate user name and video attachment
|
| 793 |
all_posts = final_state.get("allPosts", [])
|
|
@@ -898,6 +942,837 @@ def _validate_searchusers(initial_state: Dict[str, Any], final_state: Dict[str,
|
|
| 898 |
return 1.0, f"Successfully navigated to users search results page with {len(users)} users"
|
| 899 |
|
| 900 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 901 |
# Registry of all Weibo reward functions
|
| 902 |
REWARD_FUNCTIONS_WEIBO = {
|
| 903 |
"_validate_navigateprofile": _validate_navigateprofile,
|
|
@@ -920,5 +1795,25 @@ REWARD_FUNCTIONS_WEIBO = {
|
|
| 920 |
"_validate_videopostfromprofile": _validate_videopostfromprofile,
|
| 921 |
"_validate_profilefromreply": _validate_profilefromreply,
|
| 922 |
"_validate_searchusers": _validate_searchusers,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 923 |
}
|
| 924 |
-
|
|
|
|
| 3 |
"""
|
| 4 |
|
| 5 |
import logging
|
| 6 |
+
from typing import Any, Dict, Tuple, Optional
|
| 7 |
|
| 8 |
logger = logging.getLogger(__name__)
|
| 9 |
|
|
|
|
| 51 |
This function validates the final state matches the expected target state:
|
| 52 |
- currentView should be "post"
|
| 53 |
- viewedPostId should match the expected post ID
|
| 54 |
+
- viewedPostCommentTab should be set appropriately
|
| 55 |
+
- The viewed post should have the expected content
|
| 56 |
|
| 57 |
Args:
|
| 58 |
initial_state: The initial state before navigation
|
|
|
|
| 68 |
if current_view != "post":
|
| 69 |
return 0.0, f"Not on post detail page, current view: {current_view}"
|
| 70 |
|
| 71 |
+
# Check 2: viewedPostId exists
|
| 72 |
viewed_post_id = final_state.get("viewedPostId")
|
| 73 |
+
if viewed_post_id is None:
|
| 74 |
+
return 0.0, "viewedPostId is None"
|
| 75 |
|
| 76 |
+
# Check 3: Find the post in allPosts and validate content
|
| 77 |
+
all_posts = final_state.get("allPosts", [])
|
| 78 |
+
target_post = next((p for p in all_posts if p.get("id") == viewed_post_id), None)
|
| 79 |
+
|
| 80 |
+
if target_post is None:
|
| 81 |
+
return 0.0, f"Post with ID '{viewed_post_id}' not found in allPosts"
|
| 82 |
+
|
| 83 |
+
# Check 4: Post should have expected content
|
| 84 |
+
expected_content = "旅行途中看到的美景,分享给大家一起欣赏"
|
| 85 |
+
post_content = target_post.get("content", "")
|
| 86 |
+
if post_content != expected_content:
|
| 87 |
+
return 0.0, f"Expected post content to be '{expected_content}', got '{post_content}'"
|
| 88 |
+
|
| 89 |
+
# Check 5: viewedPostCommentTab is "hot" (default tab for post detail)
|
| 90 |
+
comment_tab = final_state.get("viewedPostCommentTab")
|
| 91 |
if comment_tab != "hot":
|
| 92 |
+
return 0.0, f"Expected viewedPostCommentTab to be 'hot', got '{comment_tab}'"
|
| 93 |
|
| 94 |
+
return 1.0, "Successfully navigated to post detail page"
|
| 95 |
|
| 96 |
|
| 97 |
def _validate_loadmoreposts(initial_state: Dict[str, Any], final_state: Dict[str, Any]) -> Tuple[float, str]:
|
|
|
|
| 100 |
|
| 101 |
This function validates the final state matches the expected target state:
|
| 102 |
- currentView should remain "feed"
|
| 103 |
+
- feedDisplayedPosts should have increased
|
| 104 |
- isLoadingPosts should be False (loading completed)
|
| 105 |
|
| 106 |
Args:
|
|
|
|
| 117 |
if current_view != "feed":
|
| 118 |
return 0.0, f"Not on feed page, current view: {current_view}"
|
| 119 |
|
| 120 |
+
# Check 2: feedDisplayedPosts has increased
|
| 121 |
+
initial_posts = initial_state.get("feedDisplayedPosts", [])
|
| 122 |
+
final_posts = final_state.get("feedDisplayedPosts", [])
|
| 123 |
|
| 124 |
initial_count = len(initial_posts)
|
| 125 |
final_count = len(final_posts)
|
|
|
|
| 127 |
if final_count <= initial_count:
|
| 128 |
return 0.0, f"Posts did not increase: {initial_count} -> {final_count} (expected increase)"
|
| 129 |
|
| 130 |
+
# Check 3: isLoadingPosts should be False (loading completed)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
is_loading = final_state.get("isLoadingPosts")
|
| 132 |
if is_loading:
|
| 133 |
return 0.0, f"Expected isLoadingPosts to be False after loading, got {is_loading}"
|
|
|
|
| 142 |
This function validates the final state matches the expected target state:
|
| 143 |
- currentView should be "post"
|
| 144 |
- viewedPostId should match the expected post ID (31)
|
| 145 |
+
- viewedPostCommentTab should be "hot" (default tab)
|
| 146 |
- viewedUserId should be None (cleared when navigating to post detail)
|
| 147 |
+
- loadedPosts should remain unchanged (persisted across pages)
|
| 148 |
+
- The viewed post should have the expected content
|
| 149 |
|
| 150 |
Args:
|
| 151 |
initial_state: The initial state before navigation
|
|
|
|
| 161 |
if current_view != "post":
|
| 162 |
return 0.0, f"Not on post detail page, current view: {current_view}"
|
| 163 |
|
| 164 |
+
# Check 2: viewedPostId exists
|
| 165 |
viewed_post_id = final_state.get("viewedPostId")
|
| 166 |
+
if viewed_post_id is None:
|
| 167 |
+
return 0.0, "viewedPostId is None"
|
| 168 |
|
| 169 |
+
# Check 3: Find the post in allPosts and validate content
|
| 170 |
+
all_posts = final_state.get("allPosts", [])
|
| 171 |
+
target_post = next((p for p in all_posts if p.get("id") == viewed_post_id), None)
|
| 172 |
+
|
| 173 |
+
if target_post is None:
|
| 174 |
+
return 0.0, f"Post with ID '{viewed_post_id}' not found in allPosts"
|
| 175 |
+
|
| 176 |
+
# Check 4: Post should have expected content
|
| 177 |
+
expected_content = "今天和朋友们一起聚餐,聊得很开心。友谊是最珍贵的财富。"
|
| 178 |
+
post_content = target_post.get("content", "")
|
| 179 |
+
if post_content != expected_content:
|
| 180 |
+
return 0.0, f"Expected post content to be '{expected_content}', got '{post_content}'"
|
| 181 |
+
|
| 182 |
+
# Check 5: viewedPostCommentTab is "hot" (default tab for post detail)
|
| 183 |
+
comment_tab = final_state.get("viewedPostCommentTab")
|
| 184 |
if comment_tab != "hot":
|
| 185 |
+
return 0.0, f"Expected viewedPostCommentTab to be 'hot', got '{comment_tab}'"
|
| 186 |
|
| 187 |
+
# Check 6: viewedUserId should be None (cleared when navigating to post)
|
| 188 |
viewed_user_id = final_state.get("viewedUserId")
|
| 189 |
if viewed_user_id is not None:
|
| 190 |
return 0.0, f"Expected viewedUserId to be None after navigating to post, got '{viewed_user_id}'"
|
| 191 |
|
| 192 |
+
# Check 7: loadedPosts should remain unchanged (persisted across pages)
|
| 193 |
+
initial_loaded = initial_state.get("loadedPosts", [])
|
| 194 |
+
final_loaded = final_state.get("loadedPosts", [])
|
| 195 |
|
| 196 |
+
initial_count = len(initial_loaded)
|
| 197 |
+
final_count = len(final_loaded)
|
| 198 |
|
| 199 |
if initial_count != final_count:
|
| 200 |
+
return 0.0, f"loadedPosts count changed: {initial_count} -> {final_count} (should remain unchanged)"
|
| 201 |
|
| 202 |
+
return 1.0, "Successfully navigated to post detail page from profile"
|
| 203 |
|
| 204 |
|
| 205 |
def _validate_partialsearchquery(initial_state: Dict[str, Any], final_state: Dict[str, Any]) -> Tuple[float, str]:
|
|
|
|
| 413 |
|
| 414 |
This function validates the final state matches the expected target state:
|
| 415 |
- currentView should be "post"
|
| 416 |
+
- viewedPostId should match the expected post ID
|
| 417 |
+
- viewedPostCommentTab should be "hot" (default tab)
|
| 418 |
- searchQuery should be empty (cleared after navigation)
|
| 419 |
- viewedUserId should be None (cleared when navigating to post detail)
|
| 420 |
+
- The viewed post should be from the expected user and have the expected content
|
| 421 |
|
| 422 |
Args:
|
| 423 |
initial_state: The initial state before navigation (on search results page)
|
|
|
|
| 433 |
if current_view != "post":
|
| 434 |
return 0.0, f"Not on post detail page, current view: {current_view}"
|
| 435 |
|
| 436 |
+
# Check 2: viewedPostId exists
|
| 437 |
viewed_post_id = final_state.get("viewedPostId")
|
| 438 |
+
if viewed_post_id is None:
|
| 439 |
+
return 0.0, "viewedPostId is None"
|
| 440 |
+
|
| 441 |
+
# Check 3: Find the post in allPosts and validate user and content
|
| 442 |
+
all_posts = final_state.get("allPosts", [])
|
| 443 |
+
target_post = next((p for p in all_posts if p.get("id") == viewed_post_id), None)
|
| 444 |
|
| 445 |
+
if target_post is None:
|
| 446 |
+
return 0.0, f"Post with ID '{viewed_post_id}' not found in allPosts"
|
| 447 |
+
|
| 448 |
+
# Check 4: Post should be from user "科技资讯"
|
| 449 |
+
post_user = target_post.get("user", {})
|
| 450 |
+
user_name = post_user.get("name", "")
|
| 451 |
+
if user_name != "科技资讯":
|
| 452 |
+
return 0.0, f"Expected post to be from user '科技资讯', got '{user_name}'"
|
| 453 |
+
|
| 454 |
+
# Check 5: Post should have expected content
|
| 455 |
+
expected_content = "最新的科技新闻分享,AI技术的应用越来越广泛,未来可期!"
|
| 456 |
+
post_content = target_post.get("content", "")
|
| 457 |
+
if post_content != expected_content:
|
| 458 |
+
return 0.0, f"Expected post content to be '{expected_content}', got '{post_content}'"
|
| 459 |
+
|
| 460 |
+
# Check 6: viewedPostCommentTab is "hot" (default tab for post detail)
|
| 461 |
+
comment_tab = final_state.get("viewedPostCommentTab")
|
| 462 |
if comment_tab != "hot":
|
| 463 |
+
return 0.0, f"Expected viewedPostCommentTab to be 'hot', got '{comment_tab}'"
|
| 464 |
|
| 465 |
+
# Check 7: searchQuery should be empty (cleared after navigation)
|
| 466 |
search_query = final_state.get("searchQuery")
|
| 467 |
if search_query != "":
|
| 468 |
return 0.0, f"Expected searchQuery to be empty after navigation, got '{search_query}'"
|
| 469 |
|
| 470 |
+
# Check 8: viewedUserId should be None (cleared when navigating to post)
|
| 471 |
viewed_user_id = final_state.get("viewedUserId")
|
| 472 |
if viewed_user_id is not None:
|
| 473 |
return 0.0, f"Expected viewedUserId to be None after navigating to post, got '{viewed_user_id}'"
|
| 474 |
|
| 475 |
+
return 1.0, "Successfully navigated to post detail page from search results"
|
| 476 |
|
| 477 |
|
| 478 |
def _validate_acceptsearchsuggestion(initial_state: Dict[str, Any], final_state: Dict[str, Any]) -> Tuple[float, str]:
|
|
|
|
| 652 |
This function validates the final state matches the expected target state:
|
| 653 |
- currentView should be "post"
|
| 654 |
- viewedPostId should match the expected post ID (23)
|
| 655 |
+
- viewedPostCommentTab should be "hot" (default tab)
|
| 656 |
- The post should be from user "读书笔记"
|
| 657 |
- The post should have exactly 3 attachments (media items)
|
| 658 |
|
|
|
|
| 675 |
if viewed_post_id != "23":
|
| 676 |
return 0.0, f"Expected viewedPostId to be '23', got '{viewed_post_id}'"
|
| 677 |
|
| 678 |
+
# Check 3: viewedPostCommentTab is "hot" (default tab for post detail)
|
| 679 |
+
comment_tab = final_state.get("viewedPostCommentTab")
|
| 680 |
if comment_tab != "hot":
|
| 681 |
+
return 0.0, f"Expected viewedPostCommentTab to be 'hot', got '{comment_tab}'"
|
| 682 |
|
| 683 |
# Check 4: Find the post in allPosts and validate user name and attachments
|
| 684 |
all_posts = final_state.get("allPosts", [])
|
|
|
|
| 805 |
This function validates the final state matches the expected target state:
|
| 806 |
- currentView should be "post"
|
| 807 |
- viewedPostId should match the expected post ID (23)
|
| 808 |
+
- viewedPostCommentTab should be "hot" (default tab)
|
| 809 |
- The post should be from user "读书笔记"
|
| 810 |
- The post should have at least one video attachment (media item with type "video")
|
| 811 |
|
|
|
|
| 828 |
if viewed_post_id != "23":
|
| 829 |
return 0.0, f"Expected viewedPostId to be '23', got '{viewed_post_id}'"
|
| 830 |
|
| 831 |
+
# Check 3: viewedPostCommentTab is "hot" (default tab for post detail)
|
| 832 |
+
comment_tab = final_state.get("viewedPostCommentTab")
|
| 833 |
if comment_tab != "hot":
|
| 834 |
+
return 0.0, f"Expected viewedPostCommentTab to be 'hot', got '{comment_tab}'"
|
| 835 |
|
| 836 |
# Check 4: Find the post in allPosts and validate user name and video attachment
|
| 837 |
all_posts = final_state.get("allPosts", [])
|
|
|
|
| 942 |
return 1.0, f"Successfully navigated to users search results page with {len(users)} users"
|
| 943 |
|
| 944 |
|
| 945 |
+
def _find_user_by_name(users: list, name: str) -> Optional[Dict[str, Any]]:
|
| 946 |
+
"""Find a user by name in the users list."""
|
| 947 |
+
for user in users:
|
| 948 |
+
if user.get("name") == name:
|
| 949 |
+
return user
|
| 950 |
+
return None
|
| 951 |
+
|
| 952 |
+
|
| 953 |
+
def _find_post_by_user_name(all_posts: list, user_name: str, index: int = 0) -> Optional[Dict[str, Any]]:
|
| 954 |
+
"""Find a post by user name and index (0-based)."""
|
| 955 |
+
posts_by_user = [p for p in all_posts if p.get("user", {}).get("name") == user_name]
|
| 956 |
+
if index < len(posts_by_user):
|
| 957 |
+
return posts_by_user[index]
|
| 958 |
+
return None
|
| 959 |
+
|
| 960 |
+
|
| 961 |
+
def _validate_navigatetoemptylatestfeed(initial_state: Dict[str, Any], final_state: Dict[str, Any]) -> Tuple[float, str]:
|
| 962 |
+
"""
|
| 963 |
+
Validate that the user successfully navigated to the latest feed page which should be empty.
|
| 964 |
+
|
| 965 |
+
Args:
|
| 966 |
+
initial_state: The initial state before navigation
|
| 967 |
+
final_state: The final state after navigation
|
| 968 |
+
|
| 969 |
+
Returns:
|
| 970 |
+
Tuple of (score, reason) where score is 1.0 for success, 0.0 for failure
|
| 971 |
+
"""
|
| 972 |
+
logger.debug(f"Running reward function on state: {final_state}")
|
| 973 |
+
|
| 974 |
+
# Check 1: currentView is "latest"
|
| 975 |
+
current_view = final_state.get("currentView")
|
| 976 |
+
if current_view != "latest":
|
| 977 |
+
return 0.0, f"Not on latest feed page, current view: {current_view}"
|
| 978 |
+
|
| 979 |
+
# Check 2: latestDisplayedPosts is empty
|
| 980 |
+
latest_posts = final_state.get("latestDisplayedPosts", [])
|
| 981 |
+
if len(latest_posts) != 0:
|
| 982 |
+
return 0.0, f"Expected latestDisplayedPosts to be empty, got {len(latest_posts)} posts"
|
| 983 |
+
|
| 984 |
+
return 1.0, "Successfully navigated to empty latest feed page"
|
| 985 |
+
|
| 986 |
+
|
| 987 |
+
def _validate_likepostfrommainfeed(initial_state: Dict[str, Any], final_state: Dict[str, Any]) -> Tuple[float, str]:
|
| 988 |
+
"""
|
| 989 |
+
Validate that the user successfully liked a post from the main feed.
|
| 990 |
+
|
| 991 |
+
Args:
|
| 992 |
+
initial_state: The initial state before liking
|
| 993 |
+
final_state: The final state after liking
|
| 994 |
+
|
| 995 |
+
Returns:
|
| 996 |
+
Tuple of (score, reason) where score is 1.0 for success, 0.0 for failure
|
| 997 |
+
"""
|
| 998 |
+
logger.debug(f"Running reward function on state: {final_state}")
|
| 999 |
+
|
| 1000 |
+
# Find post 1 (first post by 用户小王)
|
| 1001 |
+
all_posts = final_state.get("allPosts", [])
|
| 1002 |
+
users = final_state.get("users", [])
|
| 1003 |
+
user_xiaowang = _find_user_by_name(users, "用户小王")
|
| 1004 |
+
|
| 1005 |
+
if user_xiaowang is None:
|
| 1006 |
+
return 0.0, "User '用户小王' not found in users list"
|
| 1007 |
+
|
| 1008 |
+
post_1 = _find_post_by_user_name(all_posts, "用户小王", 0)
|
| 1009 |
+
if post_1 is None:
|
| 1010 |
+
return 0.0, "Post 1 (first post by 用户小王) not found"
|
| 1011 |
+
|
| 1012 |
+
post_1_id = post_1.get("id")
|
| 1013 |
+
|
| 1014 |
+
# Check: Post 1's like count has increased
|
| 1015 |
+
initial_post = next((p for p in initial_state.get("allPosts", []) if p.get("id") == post_1_id), None)
|
| 1016 |
+
if initial_post is None:
|
| 1017 |
+
return 0.0, f"Post 1 (ID: {post_1_id}) not found in initial state"
|
| 1018 |
+
|
| 1019 |
+
initial_likes = initial_post.get("likeCount", 0)
|
| 1020 |
+
final_likes = post_1.get("likeCount", 0)
|
| 1021 |
+
|
| 1022 |
+
if final_likes <= initial_likes:
|
| 1023 |
+
return 0.0, f"Post 1's like count did not increase: {initial_likes} -> {final_likes}"
|
| 1024 |
+
|
| 1025 |
+
return 1.0, f"Successfully liked post 1 (ID: {post_1_id}), like count increased from {initial_likes} to {final_likes}"
|
| 1026 |
+
|
| 1027 |
+
|
| 1028 |
+
def _validate_openinlinecommentssection(initial_state: Dict[str, Any], final_state: Dict[str, Any]) -> Tuple[float, str]:
|
| 1029 |
+
"""
|
| 1030 |
+
Validate that the user successfully opened the inline comments section for a post.
|
| 1031 |
+
|
| 1032 |
+
Args:
|
| 1033 |
+
initial_state: The initial state before opening comments
|
| 1034 |
+
final_state: The final state after opening comments
|
| 1035 |
+
|
| 1036 |
+
Returns:
|
| 1037 |
+
Tuple of (score, reason) where score is 1.0 for success, 0.0 for failure
|
| 1038 |
+
"""
|
| 1039 |
+
logger.debug(f"Running reward function on state: {final_state}")
|
| 1040 |
+
|
| 1041 |
+
# Find the first post in feedDisplayedPosts
|
| 1042 |
+
feed_posts = final_state.get("feedDisplayedPosts", [])
|
| 1043 |
+
if len(feed_posts) == 0:
|
| 1044 |
+
return 0.0, "No posts in feedDisplayedPosts"
|
| 1045 |
+
|
| 1046 |
+
first_post = feed_posts[0]
|
| 1047 |
+
post_id = first_post.get("id")
|
| 1048 |
+
|
| 1049 |
+
# Check: isCommentsOpen should be true
|
| 1050 |
+
comments_open = first_post.get("isCommentsOpen", False)
|
| 1051 |
+
if not comments_open:
|
| 1052 |
+
return 0.0, f"Comments section is not open for post {post_id}"
|
| 1053 |
+
|
| 1054 |
+
return 1.0, f"Successfully opened comments section for post {post_id}"
|
| 1055 |
+
|
| 1056 |
+
|
| 1057 |
+
def _validate_navigateviatrendingtopic(initial_state: Dict[str, Any], final_state: Dict[str, Any]) -> Tuple[float, str]:
|
| 1058 |
+
"""
|
| 1059 |
+
Validate that the user successfully navigated to search results via trending topic.
|
| 1060 |
+
|
| 1061 |
+
Args:
|
| 1062 |
+
initial_state: The initial state before navigation
|
| 1063 |
+
final_state: The final state after navigation
|
| 1064 |
+
|
| 1065 |
+
Returns:
|
| 1066 |
+
Tuple of (score, reason) where score is 1.0 for success, 0.0 for failure
|
| 1067 |
+
"""
|
| 1068 |
+
logger.debug(f"Running reward function on state: {final_state}")
|
| 1069 |
+
|
| 1070 |
+
# Check 1: currentView is "search"
|
| 1071 |
+
current_view = final_state.get("currentView")
|
| 1072 |
+
if current_view != "search":
|
| 1073 |
+
return 0.0, f"Not on search results page, current view: {current_view}"
|
| 1074 |
+
|
| 1075 |
+
# Check 2: searchQuery is set (should match trending topic text)
|
| 1076 |
+
search_query = final_state.get("searchQuery")
|
| 1077 |
+
if not search_query or search_query == "":
|
| 1078 |
+
return 0.0, "searchQuery is not set"
|
| 1079 |
+
|
| 1080 |
+
# Check 3: search results are displayed (if any) - this is optional per success criteria
|
| 1081 |
+
# Navigation is successful as long as we're on search page with query set
|
| 1082 |
+
|
| 1083 |
+
return 1.0, f"Successfully navigated to search results with query '{search_query}'"
|
| 1084 |
+
|
| 1085 |
+
|
| 1086 |
+
def _validate_openpostcomposermoredropdown(initial_state: Dict[str, Any], final_state: Dict[str, Any]) -> Tuple[float, str]:
|
| 1087 |
+
"""
|
| 1088 |
+
Validate that the user successfully typed in post composer and opened the more dropdown.
|
| 1089 |
+
|
| 1090 |
+
Args:
|
| 1091 |
+
initial_state: The initial state before typing
|
| 1092 |
+
final_state: The final state after opening dropdown
|
| 1093 |
+
|
| 1094 |
+
Returns:
|
| 1095 |
+
Tuple of (score, reason) where score is 1.0 for success, 0.0 for failure
|
| 1096 |
+
"""
|
| 1097 |
+
logger.debug(f"Running reward function on state: {final_state}")
|
| 1098 |
+
|
| 1099 |
+
# Check 1: postComposerText contains typed text
|
| 1100 |
+
composer_text = final_state.get("postComposerText", "")
|
| 1101 |
+
if composer_text == "":
|
| 1102 |
+
return 0.0, "postComposerText is empty"
|
| 1103 |
+
|
| 1104 |
+
# Check 2: moreOptionsDropdownOpen is true
|
| 1105 |
+
more_dropdown_open = final_state.get("moreOptionsDropdownOpen", False)
|
| 1106 |
+
if not more_dropdown_open:
|
| 1107 |
+
return 0.0, "moreOptionsDropdownOpen is not true"
|
| 1108 |
+
|
| 1109 |
+
return 1.0, f"Successfully typed text and opened more dropdown"
|
| 1110 |
+
|
| 1111 |
+
|
| 1112 |
+
def _validate_unlikeallpostsonprofile(initial_state: Dict[str, Any], final_state: Dict[str, Any]) -> Tuple[float, str]:
|
| 1113 |
+
"""
|
| 1114 |
+
Validate that the user successfully unliked all posts on a profile page.
|
| 1115 |
+
|
| 1116 |
+
Args:
|
| 1117 |
+
initial_state: The initial state before unliking (all posts liked)
|
| 1118 |
+
final_state: The final state after unliking
|
| 1119 |
+
|
| 1120 |
+
Returns:
|
| 1121 |
+
Tuple of (score, reason) where score is 1.0 for success, 0.0 for failure
|
| 1122 |
+
"""
|
| 1123 |
+
logger.debug(f"Running reward function on state: {final_state}")
|
| 1124 |
+
|
| 1125 |
+
# Get viewed user ID
|
| 1126 |
+
viewed_user_id = final_state.get("viewedUserId")
|
| 1127 |
+
if viewed_user_id is None:
|
| 1128 |
+
return 0.0, "viewedUserId is None"
|
| 1129 |
+
|
| 1130 |
+
# Find all posts by this user
|
| 1131 |
+
all_posts = final_state.get("allPosts", [])
|
| 1132 |
+
user_posts = [p for p in all_posts if p.get("user", {}).get("id") == viewed_user_id]
|
| 1133 |
+
|
| 1134 |
+
if len(user_posts) == 0:
|
| 1135 |
+
return 0.0, f"No posts found for user {viewed_user_id}"
|
| 1136 |
+
|
| 1137 |
+
# Check: None of the user's posts should be in likedPostIds
|
| 1138 |
+
liked_post_ids = final_state.get("likedPostIds", set())
|
| 1139 |
+
if isinstance(liked_post_ids, list):
|
| 1140 |
+
liked_post_ids = set(liked_post_ids)
|
| 1141 |
+
|
| 1142 |
+
for post in user_posts:
|
| 1143 |
+
post_id = post.get("id")
|
| 1144 |
+
if post_id in liked_post_ids:
|
| 1145 |
+
return 0.0, f"Post {post_id} is still in likedPostIds"
|
| 1146 |
+
|
| 1147 |
+
# Check: All post like counts should have decreased
|
| 1148 |
+
initial_posts = {p.get("id"): p for p in initial_state.get("allPosts", [])}
|
| 1149 |
+
for post in user_posts:
|
| 1150 |
+
post_id = post.get("id")
|
| 1151 |
+
initial_post = initial_posts.get(post_id)
|
| 1152 |
+
if initial_post:
|
| 1153 |
+
initial_likes = initial_post.get("likeCount", 0)
|
| 1154 |
+
final_likes = post.get("likeCount", 0)
|
| 1155 |
+
if final_likes >= initial_likes:
|
| 1156 |
+
return 0.0, f"Post {post_id} like count did not decrease: {initial_likes} -> {final_likes}"
|
| 1157 |
+
|
| 1158 |
+
return 1.0, f"Successfully unliked all {len(user_posts)} posts on profile"
|
| 1159 |
+
|
| 1160 |
+
|
| 1161 |
+
def _validate_followuserandchecklatestfeed(initial_state: Dict[str, Any], final_state: Dict[str, Any]) -> Tuple[float, str]:
|
| 1162 |
+
"""
|
| 1163 |
+
Validate that the user successfully followed a user and their posts appear in latest feed.
|
| 1164 |
+
|
| 1165 |
+
Args:
|
| 1166 |
+
initial_state: The initial state before following
|
| 1167 |
+
final_state: The final state after navigating to latest feed
|
| 1168 |
+
|
| 1169 |
+
Returns:
|
| 1170 |
+
Tuple of (score, reason) where score is 1.0 for success, 0.0 for failure
|
| 1171 |
+
"""
|
| 1172 |
+
logger.debug(f"Running reward function on state: {final_state}")
|
| 1173 |
+
|
| 1174 |
+
# Find user 1 (用户小王)
|
| 1175 |
+
users = final_state.get("users", [])
|
| 1176 |
+
user_1 = _find_user_by_name(users, "用户小王")
|
| 1177 |
+
|
| 1178 |
+
if user_1 is None:
|
| 1179 |
+
return 0.0, "User '用户小王' not found in users list"
|
| 1180 |
+
|
| 1181 |
+
user_1_id = user_1.get("id")
|
| 1182 |
+
|
| 1183 |
+
# Check 1: User 1's ID is in followedUsers
|
| 1184 |
+
followed_users = final_state.get("followedUsers", {})
|
| 1185 |
+
if user_1_id not in followed_users:
|
| 1186 |
+
return 0.0, f"User 1's ID '{user_1_id}' is not in followedUsers"
|
| 1187 |
+
|
| 1188 |
+
# Check 2: currentView is "latest"
|
| 1189 |
+
current_view = final_state.get("currentView")
|
| 1190 |
+
if current_view != "latest":
|
| 1191 |
+
return 0.0, f"Not on latest feed page, current view: {current_view}"
|
| 1192 |
+
|
| 1193 |
+
# Check 3: latestDisplayedPosts contains posts from user 1
|
| 1194 |
+
latest_posts = final_state.get("latestDisplayedPosts", [])
|
| 1195 |
+
user_1_posts = [p for p in latest_posts if p.get("user", {}).get("id") == user_1_id]
|
| 1196 |
+
|
| 1197 |
+
if len(user_1_posts) == 0:
|
| 1198 |
+
return 0.0, f"No posts from user 1 found in latestDisplayedPosts"
|
| 1199 |
+
|
| 1200 |
+
return 1.0, f"Successfully followed user 1 and found {len(user_1_posts)} posts in latest feed"
|
| 1201 |
+
|
| 1202 |
+
|
| 1203 |
+
def _validate_changetrendingtabandnavigate(initial_state: Dict[str, Any], final_state: Dict[str, Any]) -> Tuple[float, str]:
|
| 1204 |
+
"""
|
| 1205 |
+
Validate that the user successfully changed trending tab and navigated to search results.
|
| 1206 |
+
|
| 1207 |
+
Args:
|
| 1208 |
+
initial_state: The initial state before changing tab
|
| 1209 |
+
final_state: The final state after navigation
|
| 1210 |
+
|
| 1211 |
+
Returns:
|
| 1212 |
+
Tuple of (score, reason) where score is 1.0 for success, 0.0 for failure
|
| 1213 |
+
"""
|
| 1214 |
+
logger.debug(f"Running reward function on state: {final_state}")
|
| 1215 |
+
|
| 1216 |
+
# Check 1: hotSearchTab is "trending"
|
| 1217 |
+
hot_search_tab = final_state.get("hotSearchTab")
|
| 1218 |
+
if hot_search_tab != "trending":
|
| 1219 |
+
return 0.0, f"Expected hotSearchTab to be 'trending', got '{hot_search_tab}'"
|
| 1220 |
+
|
| 1221 |
+
# Check 2: currentView is "search"
|
| 1222 |
+
current_view = final_state.get("currentView")
|
| 1223 |
+
if current_view != "search":
|
| 1224 |
+
return 0.0, f"Not on search results page, current view: {current_view}"
|
| 1225 |
+
|
| 1226 |
+
# Check 3: searchQuery is set to trending topic text
|
| 1227 |
+
search_query = final_state.get("searchQuery")
|
| 1228 |
+
if not search_query or search_query == "":
|
| 1229 |
+
return 0.0, "searchQuery is not set"
|
| 1230 |
+
|
| 1231 |
+
# Check 4: Search results page displays a hashtag banner (check if hashtagTopics exists)
|
| 1232 |
+
# If searchQuery is a hashtag (wrapped in #), extract the text between # symbols
|
| 1233 |
+
# hashtagTopics keys are the plain text without # symbols
|
| 1234 |
+
hashtag_topics = final_state.get("hashtagTopics", {})
|
| 1235 |
+
query = search_query.strip()
|
| 1236 |
+
hashtag_text = query
|
| 1237 |
+
|
| 1238 |
+
# Extract hashtag text if wrapped in # symbols (e.g., "#习近平欢迎西班牙国王访华#" -> "习近平欢迎西班牙国王访华")
|
| 1239 |
+
if query.startswith("#") and query.endswith("#"):
|
| 1240 |
+
hashtag_text = query[1:-1] # Remove # from both ends
|
| 1241 |
+
|
| 1242 |
+
if hashtag_text not in hashtag_topics:
|
| 1243 |
+
return 0.0, f"Hashtag '{hashtag_text}' not found in hashtagTopics (banner may not be displayed)"
|
| 1244 |
+
|
| 1245 |
+
return 1.0, f"Successfully changed tab and navigated to search results with query '{search_query}'"
|
| 1246 |
+
|
| 1247 |
+
|
| 1248 |
+
def _validate_createcustomgroupandnavigate(initial_state: Dict[str, Any], final_state: Dict[str, Any]) -> Tuple[float, str]:
|
| 1249 |
+
"""
|
| 1250 |
+
Validate that the user successfully created a custom group and navigated to its feed.
|
| 1251 |
+
|
| 1252 |
+
Args:
|
| 1253 |
+
initial_state: The initial state before creating group
|
| 1254 |
+
final_state: The final state after navigation
|
| 1255 |
+
|
| 1256 |
+
Returns:
|
| 1257 |
+
Tuple of (score, reason) where score is 1.0 for success, 0.0 for failure
|
| 1258 |
+
"""
|
| 1259 |
+
logger.debug(f"Running reward function on state: {final_state}")
|
| 1260 |
+
|
| 1261 |
+
# Check 1: A custom group with label "test" exists in customGroups
|
| 1262 |
+
custom_groups = final_state.get("customGroups", [])
|
| 1263 |
+
test_group = next((g for g in custom_groups if g.get("label") == "test"), None)
|
| 1264 |
+
|
| 1265 |
+
if test_group is None:
|
| 1266 |
+
return 0.0, "Custom group with label 'test' not found in customGroups"
|
| 1267 |
+
|
| 1268 |
+
test_group_id = test_group.get("id")
|
| 1269 |
+
|
| 1270 |
+
# Check 2: currentView is "custom-group-{groupId}"
|
| 1271 |
+
current_view = final_state.get("currentView")
|
| 1272 |
+
expected_view = f"custom-group-{test_group_id}"
|
| 1273 |
+
if current_view != expected_view:
|
| 1274 |
+
return 0.0, f"Expected currentView to be '{expected_view}', got '{current_view}'"
|
| 1275 |
+
|
| 1276 |
+
# Check 3: Custom group feed is displayed
|
| 1277 |
+
custom_group_displayed_posts = final_state.get("customGroupDisplayedPosts", {})
|
| 1278 |
+
group_posts = custom_group_displayed_posts.get(test_group_id, [])
|
| 1279 |
+
|
| 1280 |
+
# Feed should exist (even if empty)
|
| 1281 |
+
if test_group_id not in custom_group_displayed_posts:
|
| 1282 |
+
return 0.0, f"Custom group feed not found for group {test_group_id}"
|
| 1283 |
+
|
| 1284 |
+
return 1.0, f"Successfully created custom group 'test' and navigated to its feed"
|
| 1285 |
+
|
| 1286 |
+
|
| 1287 |
+
def _validate_deletecustomgroup(initial_state: Dict[str, Any], final_state: Dict[str, Any]) -> Tuple[float, str]:
|
| 1288 |
+
"""
|
| 1289 |
+
Validate that the user successfully deleted the first custom group.
|
| 1290 |
+
|
| 1291 |
+
Args:
|
| 1292 |
+
initial_state: The initial state before deletion
|
| 1293 |
+
final_state: The final state after deletion
|
| 1294 |
+
|
| 1295 |
+
Returns:
|
| 1296 |
+
Tuple of (score, reason) where score is 1.0 for success, 0.0 for failure
|
| 1297 |
+
"""
|
| 1298 |
+
logger.debug(f"Running reward function on state: {final_state}")
|
| 1299 |
+
|
| 1300 |
+
# Get first custom group from initial state
|
| 1301 |
+
initial_groups = initial_state.get("customGroups", [])
|
| 1302 |
+
if len(initial_groups) == 0:
|
| 1303 |
+
return 0.0, "No custom groups in initial state"
|
| 1304 |
+
|
| 1305 |
+
first_group_id = initial_groups[0].get("id")
|
| 1306 |
+
|
| 1307 |
+
# Check: First custom group no longer exists in customGroups
|
| 1308 |
+
final_groups = final_state.get("customGroups", [])
|
| 1309 |
+
deleted_group = next((g for g in final_groups if g.get("id") == first_group_id), None)
|
| 1310 |
+
|
| 1311 |
+
if deleted_group is not None:
|
| 1312 |
+
return 0.0, f"First custom group (ID: {first_group_id}) still exists in customGroups"
|
| 1313 |
+
|
| 1314 |
+
return 1.0, f"Successfully deleted first custom group (ID: {first_group_id})"
|
| 1315 |
+
|
| 1316 |
+
|
| 1317 |
+
def _validate_editcustomgroupname(initial_state: Dict[str, Any], final_state: Dict[str, Any]) -> Tuple[float, str]:
|
| 1318 |
+
"""
|
| 1319 |
+
Validate that the user successfully edited the first custom group's name.
|
| 1320 |
+
|
| 1321 |
+
Args:
|
| 1322 |
+
initial_state: The initial state before editing
|
| 1323 |
+
final_state: The final state after editing
|
| 1324 |
+
|
| 1325 |
+
Returns:
|
| 1326 |
+
Tuple of (score, reason) where score is 1.0 for success, 0.0 for failure
|
| 1327 |
+
"""
|
| 1328 |
+
logger.debug(f"Running reward function on state: {final_state}")
|
| 1329 |
+
|
| 1330 |
+
# Get first custom group from initial state
|
| 1331 |
+
initial_groups = initial_state.get("customGroups", [])
|
| 1332 |
+
if len(initial_groups) == 0:
|
| 1333 |
+
return 0.0, "No custom groups in initial state"
|
| 1334 |
+
|
| 1335 |
+
first_group_id = initial_groups[0].get("id")
|
| 1336 |
+
initial_label = initial_groups[0].get("label")
|
| 1337 |
+
|
| 1338 |
+
# Check: First custom group's label has been updated
|
| 1339 |
+
final_groups = final_state.get("customGroups", [])
|
| 1340 |
+
updated_group = next((g for g in final_groups if g.get("id") == first_group_id), None)
|
| 1341 |
+
|
| 1342 |
+
if updated_group is None:
|
| 1343 |
+
return 0.0, f"First custom group (ID: {first_group_id}) not found in final state"
|
| 1344 |
+
|
| 1345 |
+
final_label = updated_group.get("label")
|
| 1346 |
+
if final_label == initial_label:
|
| 1347 |
+
return 0.0, f"Group label was not updated: still '{initial_label}'"
|
| 1348 |
+
|
| 1349 |
+
return 1.0, f"Successfully updated group label from '{initial_label}' to '{final_label}'"
|
| 1350 |
+
|
| 1351 |
+
|
| 1352 |
+
def _validate_followandunfollowfromprofile(initial_state: Dict[str, Any], final_state: Dict[str, Any]) -> Tuple[float, str]:
|
| 1353 |
+
"""
|
| 1354 |
+
Validate that the user successfully followed then unfollowed a user from their profile.
|
| 1355 |
+
|
| 1356 |
+
Args:
|
| 1357 |
+
initial_state: The initial state before following
|
| 1358 |
+
final_state: The final state after unfollowing
|
| 1359 |
+
|
| 1360 |
+
Returns:
|
| 1361 |
+
Tuple of (score, reason) where score is 1.0 for success, 0.0 for failure
|
| 1362 |
+
"""
|
| 1363 |
+
logger.debug(f"Running reward function on state: {final_state}")
|
| 1364 |
+
|
| 1365 |
+
# Find user 2 (need to identify which user this is - checking task details suggests it's a specific user)
|
| 1366 |
+
# Since we don't have the exact user name, we'll check that a user was followed then unfollowed
|
| 1367 |
+
# by checking that current view is profile and user is not in followedUsers
|
| 1368 |
+
|
| 1369 |
+
# Check 1: currentView is "profile"
|
| 1370 |
+
current_view = final_state.get("currentView")
|
| 1371 |
+
if current_view != "profile":
|
| 1372 |
+
return 0.0, f"Not on profile page, current view: {current_view}"
|
| 1373 |
+
|
| 1374 |
+
# Check 2: viewedUserId matches user 2
|
| 1375 |
+
viewed_user_id = final_state.get("viewedUserId")
|
| 1376 |
+
if viewed_user_id is None:
|
| 1377 |
+
return 0.0, "viewedUserId is None"
|
| 1378 |
+
|
| 1379 |
+
# Check 3: User 2's ID is not in followedUsers (was unfollowed)
|
| 1380 |
+
followed_users = final_state.get("followedUsers", {})
|
| 1381 |
+
if viewed_user_id in followed_users:
|
| 1382 |
+
return 0.0, f"User 2's ID '{viewed_user_id}' is still in followedUsers (not unfollowed)"
|
| 1383 |
+
|
| 1384 |
+
# Verify that user was initially followed (check initial state had them not followed)
|
| 1385 |
+
initial_followed = initial_state.get("followedUsers", {})
|
| 1386 |
+
if viewed_user_id in initial_followed:
|
| 1387 |
+
return 0.0, f"User 2 was already followed in initial state"
|
| 1388 |
+
|
| 1389 |
+
return 1.0, f"Successfully followed then unfollowed user {viewed_user_id}"
|
| 1390 |
+
|
| 1391 |
+
|
| 1392 |
+
def _validate_unassignspecialattentionandgroups(initial_state: Dict[str, Any], final_state: Dict[str, Any]) -> Tuple[float, str]:
|
| 1393 |
+
"""
|
| 1394 |
+
Validate that the user successfully unassigned special attention and groups from a user.
|
| 1395 |
+
|
| 1396 |
+
Args:
|
| 1397 |
+
initial_state: The initial state before unassigning
|
| 1398 |
+
final_state: The final state after unassigning
|
| 1399 |
+
|
| 1400 |
+
Returns:
|
| 1401 |
+
Tuple of (score, reason) where score is 1.0 for success, 0.0 for failure
|
| 1402 |
+
"""
|
| 1403 |
+
logger.debug(f"Running reward function on state: {final_state}")
|
| 1404 |
+
|
| 1405 |
+
# Get viewed user ID
|
| 1406 |
+
viewed_user_id = final_state.get("viewedUserId")
|
| 1407 |
+
if viewed_user_id is None:
|
| 1408 |
+
return 0.0, "viewedUserId is None"
|
| 1409 |
+
|
| 1410 |
+
# Check 1: User's ID is in followedUsers
|
| 1411 |
+
followed_users = final_state.get("followedUsers", {})
|
| 1412 |
+
if viewed_user_id not in followed_users:
|
| 1413 |
+
return 0.0, f"User's ID '{viewed_user_id}' is not in followedUsers"
|
| 1414 |
+
|
| 1415 |
+
user_follow_data = followed_users.get(viewed_user_id, {})
|
| 1416 |
+
|
| 1417 |
+
# Check 2: isSpecialAttention is false (or not set)
|
| 1418 |
+
is_special = user_follow_data.get("isSpecialAttention", False)
|
| 1419 |
+
if is_special:
|
| 1420 |
+
return 0.0, f"isSpecialAttention is still true for user {viewed_user_id}"
|
| 1421 |
+
|
| 1422 |
+
# Check 3: User is not assigned to any groups (groups array is empty/not set)
|
| 1423 |
+
groups = user_follow_data.get("groups", [])
|
| 1424 |
+
if groups and len(groups) > 0:
|
| 1425 |
+
return 0.0, f"User is still assigned to groups: {groups}"
|
| 1426 |
+
|
| 1427 |
+
return 1.0, f"Successfully unassigned special attention and groups from user {viewed_user_id}"
|
| 1428 |
+
|
| 1429 |
+
|
| 1430 |
+
def _validate_createcommentwithinlinesection(initial_state: Dict[str, Any], final_state: Dict[str, Any]) -> Tuple[float, str]:
|
| 1431 |
+
"""
|
| 1432 |
+
Validate that the user successfully created a comment using the inline comments section.
|
| 1433 |
+
|
| 1434 |
+
Args:
|
| 1435 |
+
initial_state: The initial state before creating comment
|
| 1436 |
+
final_state: The final state after creating comment
|
| 1437 |
+
|
| 1438 |
+
Returns:
|
| 1439 |
+
Tuple of (score, reason) where score is 1.0 for success, 0.0 for failure
|
| 1440 |
+
"""
|
| 1441 |
+
logger.debug(f"Running reward function on state: {final_state}")
|
| 1442 |
+
|
| 1443 |
+
# Find post 2 (posted by 科技资讯)
|
| 1444 |
+
all_posts = final_state.get("allPosts", [])
|
| 1445 |
+
post_2 = _find_post_by_user_name(all_posts, "科技资讯", 0) # First post by 科技资讯
|
| 1446 |
+
|
| 1447 |
+
if post_2 is None:
|
| 1448 |
+
return 0.0, "Post 2 (posted by 科技资讯) not found"
|
| 1449 |
+
|
| 1450 |
+
post_2_id = post_2.get("id")
|
| 1451 |
+
|
| 1452 |
+
# Check 1: Post 2's comments section is open
|
| 1453 |
+
feed_posts = final_state.get("feedDisplayedPosts", [])
|
| 1454 |
+
displayed_post = next((p for p in feed_posts if p.get("id") == post_2_id), None)
|
| 1455 |
+
|
| 1456 |
+
if displayed_post is None:
|
| 1457 |
+
return 0.0, f"Post 2 not found in feedDisplayedPosts"
|
| 1458 |
+
|
| 1459 |
+
comments_open = displayed_post.get("isCommentsOpen", False)
|
| 1460 |
+
if not comments_open:
|
| 1461 |
+
return 0.0, f"Post 2's comments section is not open"
|
| 1462 |
+
|
| 1463 |
+
# Check 2: A new comment has been added to post 2's comments array
|
| 1464 |
+
initial_post = next((p for p in initial_state.get("allPosts", []) if p.get("id") == post_2_id), None)
|
| 1465 |
+
initial_comments = initial_post.get("comments", []) if initial_post else []
|
| 1466 |
+
final_comments = post_2.get("comments", [])
|
| 1467 |
+
|
| 1468 |
+
if len(final_comments) <= len(initial_comments):
|
| 1469 |
+
return 0.0, f"No new comment added: {len(initial_comments)} -> {len(final_comments)}"
|
| 1470 |
+
|
| 1471 |
+
return 1.0, f"Successfully created comment on post 2 (comments: {len(initial_comments)} -> {len(final_comments)})"
|
| 1472 |
+
|
| 1473 |
+
|
| 1474 |
+
def _validate_followandsetspecialattentionflow(initial_state: Dict[str, Any], final_state: Dict[str, Any]) -> Tuple[float, str]:
|
| 1475 |
+
"""
|
| 1476 |
+
Validate that the user successfully followed users and set special attention, then verified posts in feed.
|
| 1477 |
+
|
| 1478 |
+
Args:
|
| 1479 |
+
initial_state: The initial state before following
|
| 1480 |
+
final_state: The final state after navigating to special follow feed
|
| 1481 |
+
|
| 1482 |
+
Returns:
|
| 1483 |
+
Tuple of (score, reason) where score is 1.0 for success, 0.0 for failure
|
| 1484 |
+
"""
|
| 1485 |
+
logger.debug(f"Running reward function on state: {final_state}")
|
| 1486 |
+
|
| 1487 |
+
# Find users
|
| 1488 |
+
users = final_state.get("users", [])
|
| 1489 |
+
user_1 = _find_user_by_name(users, "用户小王")
|
| 1490 |
+
user_2 = _find_user_by_name(users, "科技资讯")
|
| 1491 |
+
|
| 1492 |
+
if user_1 is None:
|
| 1493 |
+
return 0.0, "User '用户小王' not found"
|
| 1494 |
+
if user_2 is None:
|
| 1495 |
+
return 0.0, "User '科技资讯' not found"
|
| 1496 |
+
|
| 1497 |
+
user_1_id = user_1.get("id")
|
| 1498 |
+
user_2_id = user_2.get("id")
|
| 1499 |
+
|
| 1500 |
+
# Check 1: User 1's ID is in followedUsers
|
| 1501 |
+
followed_users = final_state.get("followedUsers", {})
|
| 1502 |
+
if user_1_id not in followed_users:
|
| 1503 |
+
return 0.0, f"User 1's ID '{user_1_id}' is not in followedUsers"
|
| 1504 |
+
|
| 1505 |
+
# Check 2: User 2's ID is in followedUsers with isSpecialAttention: true
|
| 1506 |
+
if user_2_id not in followed_users:
|
| 1507 |
+
return 0.0, f"User 2's ID '{user_2_id}' is not in followedUsers"
|
| 1508 |
+
|
| 1509 |
+
user_2_data = followed_users.get(user_2_id, {})
|
| 1510 |
+
is_special = user_2_data.get("isSpecialAttention", False)
|
| 1511 |
+
if not is_special:
|
| 1512 |
+
return 0.0, f"User 2's isSpecialAttention is not true"
|
| 1513 |
+
|
| 1514 |
+
# Check 3: currentView is "special-follow"
|
| 1515 |
+
current_view = final_state.get("currentView")
|
| 1516 |
+
if current_view != "special-follow":
|
| 1517 |
+
return 0.0, f"Not on special follow feed, current view: {current_view}"
|
| 1518 |
+
|
| 1519 |
+
# Check 4: specialFollowDisplayedPosts contains posts from user 2
|
| 1520 |
+
special_posts = final_state.get("specialFollowDisplayedPosts", [])
|
| 1521 |
+
user_2_posts = [p for p in special_posts if p.get("user", {}).get("id") == user_2_id]
|
| 1522 |
+
|
| 1523 |
+
if len(user_2_posts) == 0:
|
| 1524 |
+
return 0.0, f"No posts from user 2 found in specialFollowDisplayedPosts"
|
| 1525 |
+
|
| 1526 |
+
return 1.0, f"Successfully followed users and found {len(user_2_posts)} posts from user 2 in special follow feed"
|
| 1527 |
+
|
| 1528 |
+
|
| 1529 |
+
def _validate_createpostwithexpressions(initial_state: Dict[str, Any], final_state: Dict[str, Any]) -> Tuple[float, str]:
|
| 1530 |
+
"""
|
| 1531 |
+
Validate that the user successfully created a post with expressions.
|
| 1532 |
+
|
| 1533 |
+
Args:
|
| 1534 |
+
initial_state: The initial state before creating post
|
| 1535 |
+
final_state: The final state after creating post
|
| 1536 |
+
|
| 1537 |
+
Returns:
|
| 1538 |
+
Tuple of (score, reason) where score is 1.0 for success, 0.0 for failure
|
| 1539 |
+
"""
|
| 1540 |
+
logger.debug(f"Running reward function on state: {final_state}")
|
| 1541 |
+
|
| 1542 |
+
# Check: A new post has been created
|
| 1543 |
+
initial_posts = initial_state.get("allPosts", [])
|
| 1544 |
+
final_posts = final_state.get("allPosts", [])
|
| 1545 |
+
|
| 1546 |
+
if len(final_posts) <= len(initial_posts):
|
| 1547 |
+
return 0.0, f"No new post created: {len(initial_posts)} -> {len(final_posts)}"
|
| 1548 |
+
|
| 1549 |
+
# Find the new post (should be first in feedDisplayedPosts and not in initial allPosts)
|
| 1550 |
+
feed_posts = final_state.get("feedDisplayedPosts", [])
|
| 1551 |
+
if len(feed_posts) == 0:
|
| 1552 |
+
return 0.0, "No posts in feedDisplayedPosts"
|
| 1553 |
+
|
| 1554 |
+
new_post_id = feed_posts[0].get("id")
|
| 1555 |
+
initial_post_ids = {p.get("id") for p in initial_posts}
|
| 1556 |
+
|
| 1557 |
+
if new_post_id in initial_post_ids:
|
| 1558 |
+
return 0.0, f"Post {new_post_id} already existed in initial state"
|
| 1559 |
+
|
| 1560 |
+
new_post = next((p for p in final_posts if p.get("id") == new_post_id), None)
|
| 1561 |
+
if new_post is None:
|
| 1562 |
+
return 0.0, f"New post {new_post_id} not found in allPosts"
|
| 1563 |
+
|
| 1564 |
+
# Check: Post content includes typed text and expressions
|
| 1565 |
+
post_content = new_post.get("content", "")
|
| 1566 |
+
if post_content == "":
|
| 1567 |
+
return 0.0, "New post content is empty"
|
| 1568 |
+
|
| 1569 |
+
# Check if content contains expressions (typically emoji-like characters)
|
| 1570 |
+
# Expressions might be embedded in content or stored separately
|
| 1571 |
+
# For now, just verify content exists and post is visible
|
| 1572 |
+
|
| 1573 |
+
# Check: Post is visible in main feed
|
| 1574 |
+
if new_post_id != feed_posts[0].get("id"):
|
| 1575 |
+
return 0.0, "New post is not first in feedDisplayedPosts"
|
| 1576 |
+
|
| 1577 |
+
return 1.0, f"Successfully created post with expressions (ID: {new_post_id})"
|
| 1578 |
+
|
| 1579 |
+
|
| 1580 |
+
def _validate_createcommentwithexpressionsondetail(initial_state: Dict[str, Any], final_state: Dict[str, Any]) -> Tuple[float, str]:
|
| 1581 |
+
"""
|
| 1582 |
+
Validate that the user successfully created a comment with expressions on post detail page.
|
| 1583 |
+
|
| 1584 |
+
Args:
|
| 1585 |
+
initial_state: The initial state before creating comment
|
| 1586 |
+
final_state: The final state after creating comment
|
| 1587 |
+
|
| 1588 |
+
Returns:
|
| 1589 |
+
Tuple of (score, reason) where score is 1.0 for success, 0.0 for failure
|
| 1590 |
+
"""
|
| 1591 |
+
logger.debug(f"Running reward function on state: {final_state}")
|
| 1592 |
+
|
| 1593 |
+
# Check 1: currentView is "post"
|
| 1594 |
+
current_view = final_state.get("currentView")
|
| 1595 |
+
if current_view != "post":
|
| 1596 |
+
return 0.0, f"Not on post detail page, current view: {current_view}"
|
| 1597 |
+
|
| 1598 |
+
# Check 2: viewedPostId is post 2's ID
|
| 1599 |
+
viewed_post_id = final_state.get("viewedPostId")
|
| 1600 |
+
if viewed_post_id is None:
|
| 1601 |
+
return 0.0, "viewedPostId is None"
|
| 1602 |
+
|
| 1603 |
+
# Find post 2 (posted by 科技资讯)
|
| 1604 |
+
all_posts = final_state.get("allPosts", [])
|
| 1605 |
+
post_2 = _find_post_by_user_name(all_posts, "科技资讯", 0)
|
| 1606 |
+
|
| 1607 |
+
if post_2 is None:
|
| 1608 |
+
return 0.0, "Post 2 (posted by 科技资讯) not found"
|
| 1609 |
+
|
| 1610 |
+
if post_2.get("id") != viewed_post_id:
|
| 1611 |
+
return 0.0, f"viewedPostId '{viewed_post_id}' does not match post 2"
|
| 1612 |
+
|
| 1613 |
+
# Check 3: A new comment has been added with expressions
|
| 1614 |
+
initial_post = next((p for p in initial_state.get("allPosts", []) if p.get("id") == viewed_post_id), None)
|
| 1615 |
+
initial_comments = initial_post.get("comments", []) if initial_post else []
|
| 1616 |
+
final_comments = post_2.get("comments", [])
|
| 1617 |
+
|
| 1618 |
+
if len(final_comments) <= len(initial_comments):
|
| 1619 |
+
return 0.0, f"No new comment added: {len(initial_comments)} -> {len(final_comments)}"
|
| 1620 |
+
|
| 1621 |
+
return 1.0, f"Successfully created comment with expressions on post 2 (comments: {len(initial_comments)} -> {len(final_comments)})"
|
| 1622 |
+
|
| 1623 |
+
|
| 1624 |
+
def _validate_followassigntogroupandnavigate(initial_state: Dict[str, Any], final_state: Dict[str, Any]) -> Tuple[float, str]:
|
| 1625 |
+
"""
|
| 1626 |
+
Validate that the user successfully followed a user, assigned them to a group, and navigated to group feed.
|
| 1627 |
+
|
| 1628 |
+
Args:
|
| 1629 |
+
initial_state: The initial state before following
|
| 1630 |
+
final_state: The final state after navigating to group feed
|
| 1631 |
+
|
| 1632 |
+
Returns:
|
| 1633 |
+
Tuple of (score, reason) where score is 1.0 for success, 0.0 for failure
|
| 1634 |
+
"""
|
| 1635 |
+
logger.debug(f"Running reward function on state: {final_state}")
|
| 1636 |
+
|
| 1637 |
+
# Find user 1 (用户小王)
|
| 1638 |
+
users = final_state.get("users", [])
|
| 1639 |
+
user_1 = _find_user_by_name(users, "用户小王")
|
| 1640 |
+
|
| 1641 |
+
if user_1 is None:
|
| 1642 |
+
return 0.0, "User '用户小王' not found"
|
| 1643 |
+
|
| 1644 |
+
user_1_id = user_1.get("id")
|
| 1645 |
+
|
| 1646 |
+
# Check 1: User 1's ID is in followedUsers with groups array containing a custom group ID
|
| 1647 |
+
followed_users = final_state.get("followedUsers", {})
|
| 1648 |
+
if user_1_id not in followed_users:
|
| 1649 |
+
return 0.0, f"User 1's ID '{user_1_id}' is not in followedUsers"
|
| 1650 |
+
|
| 1651 |
+
user_1_data = followed_users.get(user_1_id, {})
|
| 1652 |
+
groups = user_1_data.get("groups", [])
|
| 1653 |
+
|
| 1654 |
+
if len(groups) == 0:
|
| 1655 |
+
return 0.0, f"User 1 is not assigned to any groups"
|
| 1656 |
+
|
| 1657 |
+
group_id = groups[0] # Get first group
|
| 1658 |
+
|
| 1659 |
+
# Check 2: currentView is "custom-group-{groupId}"
|
| 1660 |
+
current_view = final_state.get("currentView")
|
| 1661 |
+
expected_view = f"custom-group-{group_id}"
|
| 1662 |
+
if current_view != expected_view:
|
| 1663 |
+
return 0.0, f"Expected currentView to be '{expected_view}', got '{current_view}'"
|
| 1664 |
+
|
| 1665 |
+
# Check 3: customGroupDisplayedPosts for that group contains posts from user 1
|
| 1666 |
+
custom_group_posts = final_state.get("customGroupDisplayedPosts", {})
|
| 1667 |
+
group_posts = custom_group_posts.get(group_id, [])
|
| 1668 |
+
user_1_posts = [p for p in group_posts if p.get("user", {}).get("id") == user_1_id]
|
| 1669 |
+
|
| 1670 |
+
if len(user_1_posts) == 0:
|
| 1671 |
+
return 0.0, f"No posts from user 1 found in custom group feed"
|
| 1672 |
+
|
| 1673 |
+
return 1.0, f"Successfully followed user 1, assigned to group, and found {len(user_1_posts)} posts in group feed"
|
| 1674 |
+
|
| 1675 |
+
|
| 1676 |
+
def _validate_searchfollowlastuser(initial_state: Dict[str, Any], final_state: Dict[str, Any]) -> Tuple[float, str]:
|
| 1677 |
+
"""
|
| 1678 |
+
Validate that the user successfully searched and followed the last user from search results.
|
| 1679 |
+
|
| 1680 |
+
Args:
|
| 1681 |
+
initial_state: The initial state before searching
|
| 1682 |
+
final_state: The final state after following
|
| 1683 |
+
|
| 1684 |
+
Returns:
|
| 1685 |
+
Tuple of (score, reason) where score is 1.0 for success, 0.0 for failure
|
| 1686 |
+
"""
|
| 1687 |
+
logger.debug(f"Running reward function on state: {final_state}")
|
| 1688 |
+
|
| 1689 |
+
# Check 1: currentView is "search"
|
| 1690 |
+
current_view = final_state.get("currentView")
|
| 1691 |
+
if current_view != "search":
|
| 1692 |
+
return 0.0, f"Not on search results page, current view: {current_view}"
|
| 1693 |
+
|
| 1694 |
+
# Check 2: searchQuery is "用"
|
| 1695 |
+
search_query = final_state.get("searchQuery")
|
| 1696 |
+
if search_query != "用":
|
| 1697 |
+
return 0.0, f"Expected searchQuery to be '用', got '{search_query}'"
|
| 1698 |
+
|
| 1699 |
+
# Check 3: searchCategory is "users"
|
| 1700 |
+
search_category = final_state.get("searchCategory")
|
| 1701 |
+
if search_category != "users":
|
| 1702 |
+
return 0.0, f"Expected searchCategory to be 'users', got '{search_category}'"
|
| 1703 |
+
|
| 1704 |
+
# Check 4: searchPageResults.users contains multiple users
|
| 1705 |
+
search_page_results = final_state.get("searchPageResults", {})
|
| 1706 |
+
users = search_page_results.get("users", [])
|
| 1707 |
+
|
| 1708 |
+
if len(users) < 2:
|
| 1709 |
+
return 0.0, f"Expected multiple users in search results, got {len(users)}"
|
| 1710 |
+
|
| 1711 |
+
# Check 5: Last user's ID is in followedUsers
|
| 1712 |
+
last_user = users[-1]
|
| 1713 |
+
last_user_id = last_user.get("id")
|
| 1714 |
+
|
| 1715 |
+
followed_users = final_state.get("followedUsers", {})
|
| 1716 |
+
if last_user_id not in followed_users:
|
| 1717 |
+
return 0.0, f"Last user's ID '{last_user_id}' is not in followedUsers"
|
| 1718 |
+
|
| 1719 |
+
return 1.0, f"Successfully searched and followed last user (ID: {last_user_id})"
|
| 1720 |
+
|
| 1721 |
+
|
| 1722 |
+
def _validate_followcreategroupandassignflow(initial_state: Dict[str, Any], final_state: Dict[str, Any]) -> Tuple[float, str]:
|
| 1723 |
+
"""
|
| 1724 |
+
Validate that the user successfully followed a user, created a group, and assigned the user to it.
|
| 1725 |
+
|
| 1726 |
+
Args:
|
| 1727 |
+
initial_state: The initial state before following
|
| 1728 |
+
final_state: The final state after assigning
|
| 1729 |
+
|
| 1730 |
+
Returns:
|
| 1731 |
+
Tuple of (score, reason) where score is 1.0 for success, 0.0 for failure
|
| 1732 |
+
"""
|
| 1733 |
+
logger.debug(f"Running reward function on state: {final_state}")
|
| 1734 |
+
|
| 1735 |
+
# Get viewed user ID
|
| 1736 |
+
viewed_user_id = final_state.get("viewedUserId")
|
| 1737 |
+
if viewed_user_id is None:
|
| 1738 |
+
return 0.0, "viewedUserId is None"
|
| 1739 |
+
|
| 1740 |
+
# Check 1: User's ID is in followedUsers
|
| 1741 |
+
followed_users = final_state.get("followedUsers", {})
|
| 1742 |
+
if viewed_user_id not in followed_users:
|
| 1743 |
+
return 0.0, f"User's ID '{viewed_user_id}' is not in followedUsers"
|
| 1744 |
+
|
| 1745 |
+
# Check 2: A new custom group exists in customGroups
|
| 1746 |
+
initial_groups = initial_state.get("customGroups", [])
|
| 1747 |
+
final_groups = final_state.get("customGroups", [])
|
| 1748 |
+
|
| 1749 |
+
if len(final_groups) <= len(initial_groups):
|
| 1750 |
+
return 0.0, f"No new custom group created: {len(initial_groups)} -> {len(final_groups)}"
|
| 1751 |
+
|
| 1752 |
+
# Find the new group (should be one that wasn't in initial state)
|
| 1753 |
+
initial_group_ids = {g.get("id") for g in initial_groups}
|
| 1754 |
+
new_group = next((g for g in final_groups if g.get("id") not in initial_group_ids), None)
|
| 1755 |
+
|
| 1756 |
+
if new_group is None:
|
| 1757 |
+
return 0.0, "No new custom group found"
|
| 1758 |
+
|
| 1759 |
+
new_group_id = new_group.get("id")
|
| 1760 |
+
|
| 1761 |
+
# Check 3: User's ID is in followedUsers with groups array containing the new group ID
|
| 1762 |
+
user_data = followed_users.get(viewed_user_id, {})
|
| 1763 |
+
groups = user_data.get("groups", [])
|
| 1764 |
+
|
| 1765 |
+
if new_group_id not in groups:
|
| 1766 |
+
return 0.0, f"User is not assigned to new group '{new_group_id}'"
|
| 1767 |
+
|
| 1768 |
+
# Check 4: manageGroupsModalOpen is false (modal closed)
|
| 1769 |
+
modal_open = final_state.get("manageGroupsModalOpen", False)
|
| 1770 |
+
if modal_open:
|
| 1771 |
+
return 0.0, "manageGroupsModalOpen is still true (modal not closed)"
|
| 1772 |
+
|
| 1773 |
+
return 1.0, f"Successfully followed user, created group '{new_group.get('label')}', and assigned user to it"
|
| 1774 |
+
|
| 1775 |
+
|
| 1776 |
# Registry of all Weibo reward functions
|
| 1777 |
REWARD_FUNCTIONS_WEIBO = {
|
| 1778 |
"_validate_navigateprofile": _validate_navigateprofile,
|
|
|
|
| 1795 |
"_validate_videopostfromprofile": _validate_videopostfromprofile,
|
| 1796 |
"_validate_profilefromreply": _validate_profilefromreply,
|
| 1797 |
"_validate_searchusers": _validate_searchusers,
|
| 1798 |
+
# New breadth 1 tasks
|
| 1799 |
+
"_validate_navigatetoemptylatestfeed": _validate_navigatetoemptylatestfeed,
|
| 1800 |
+
"_validate_likepostfrommainfeed": _validate_likepostfrommainfeed,
|
| 1801 |
+
"_validate_openinlinecommentssection": _validate_openinlinecommentssection,
|
| 1802 |
+
"_validate_navigateviatrendingtopic": _validate_navigateviatrendingtopic,
|
| 1803 |
+
"_validate_openpostcomposermoredropdown": _validate_openpostcomposermoredropdown,
|
| 1804 |
+
"_validate_unlikeallpostsonprofile": _validate_unlikeallpostsonprofile,
|
| 1805 |
+
"_validate_followuserandchecklatestfeed": _validate_followuserandchecklatestfeed,
|
| 1806 |
+
"_validate_changetrendingtabandnavigate": _validate_changetrendingtabandnavigate,
|
| 1807 |
+
"_validate_createcustomgroupandnavigate": _validate_createcustomgroupandnavigate,
|
| 1808 |
+
"_validate_deletecustomgroup": _validate_deletecustomgroup,
|
| 1809 |
+
"_validate_editcustomgroupname": _validate_editcustomgroupname,
|
| 1810 |
+
"_validate_followandunfollowfromprofile": _validate_followandunfollowfromprofile,
|
| 1811 |
+
"_validate_unassignspecialattentionandgroups": _validate_unassignspecialattentionandgroups,
|
| 1812 |
+
"_validate_createcommentwithinlinesection": _validate_createcommentwithinlinesection,
|
| 1813 |
+
"_validate_followandsetspecialattentionflow": _validate_followandsetspecialattentionflow,
|
| 1814 |
+
"_validate_createpostwithexpressions": _validate_createpostwithexpressions,
|
| 1815 |
+
"_validate_createcommentwithexpressionsondetail": _validate_createcommentwithexpressionsondetail,
|
| 1816 |
+
"_validate_followassigntogroupandnavigate": _validate_followassigntogroupandnavigate,
|
| 1817 |
+
"_validate_searchfollowlastuser": _validate_searchfollowlastuser,
|
| 1818 |
+
"_validate_followcreategroupandassignflow": _validate_followcreategroupandassignflow,
|
| 1819 |
}
|
|
|
tasks/weibo/accept-search-suggestion.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/change-search-categories.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/change-trending-tab-and-navigate.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/create-comment-with-expressions-on-detail.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/create-comment-with-inline-section.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/create-custom-group-and-navigate.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/create-post-with-expressions.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/delete-custom-group.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/edit-custom-group-name.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/follow-and-set-special-attention-flow.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/follow-and-unfollow-from-profile.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/follow-assign-to-group-and-navigate.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/follow-create-group-and-assign-flow.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/follow-user-and-check-latest-feed.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/home-from-search.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/like-post-from-main-feed.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/load-many-posts.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/load-more-posts.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/navigate-post.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/navigate-profile.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/navigate-to-empty-latest-feed.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/navigate-via-trending-topic.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/no-search-suggestions.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/open-inline-comments-section.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/open-post-composer-more-dropdown.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/partial-search-query.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/post-from-profile.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/post-from-search.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/profile-from-comments.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/profile-from-post.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/profile-from-reply.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/profile-from-search.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/profile-from-sorted-comments.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/search-dropdown-profile.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/search-follow-last-user.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/search-users.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/switch-theme.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/unassign-special-attention-and-groups.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/unlike-all-posts-on-profile.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/weibo/video-post-from-profile.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|