-
Notifications
You must be signed in to change notification settings - Fork 12
fix(research): restore feedback track ux on current dev #341
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
Changes from all commits
155619c
172e86c
57ea2e7
d72c8e1
300b394
eb8f614
213d85f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -524,7 +524,7 @@ def __init__( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| config=self.config.track_router, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self._layer0_cache: Dict[str, Dict[str, Any]] = {} # keyed by user_id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self._layer0_cache_ts: Dict[str, float] = {} # keyed by user_id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self._layer0_cache_ts: Dict[str, float] = {} # keyed by user_id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self._layer0_ttl: float = 300.0 # 5 minutes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def _attach_latest_judge(self, papers: List[Dict[str, Any]]) -> None: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -591,9 +591,7 @@ def _load_layer0_profile(self, user_id: str) -> List[Dict[str, Any]]: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self._layer0_cache_ts[user_id] = now | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return prefs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def _load_layer1_track( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self, user_id: str, track: Optional[Dict[str, Any]] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) -> Dict[str, Any]: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def _load_layer1_track(self, user_id: str, track: Optional[Dict[str, Any]]) -> Dict[str, Any]: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Layer 1: track context — goals, keywords, tasks, milestones (~500 tokens).""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tasks: List[Dict[str, Any]] = [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| milestones: List[Dict[str, Any]] = [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -771,9 +769,7 @@ def _total_tokens() -> int: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return prefs, task_list, milestone_list, relevant, cross_track, paper, layers, trimmed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def _load_layer3_paper( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self, user_id: str, paper_id: Optional[str] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) -> List[Dict[str, Any]]: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def _load_layer3_paper(self, user_id: str, paper_id: Optional[str]) -> List[Dict[str, Any]]: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Layer 3: paper-scoped memories (on-demand, only when paper_id given).""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if not paper_id: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -917,11 +913,23 @@ async def build_context_pack( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if self.config.personalized and routed_track: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| feedback_rows = self.research_store.list_paper_feedback( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| user_id=user_id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| track_id=int(routed_track["id"]), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| limit=500, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| list_effective_feedback = getattr( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.research_store, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "list_effective_paper_feedback", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| None, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if callable(list_effective_feedback): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| feedback_rows = list_effective_feedback( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| user_id=user_id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| track_id=int(routed_track["id"]), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| limit=500, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| feedback_rows = self.research_store.list_paper_feedback( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| user_id=user_id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| track_id=int(routed_track["id"]), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| limit=500, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+916
to
+932
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The use of
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| default_rrf_weights = getattr( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.search_service, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "DEFAULT_SOURCE_WEIGHTS", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The constants (
_FEEDBACK_ACTION_ALIASES, etc.) and helper functions (_normalize_feedback_action,_collapse_effective_feedback_actions) for handling feedback actions are duplicated fromsrc/paperbot/infrastructure/stores/research_store.py. This duplication can lead to inconsistencies if the logic is updated in one place but not the other. To improve maintainability, this logic should be centralized. SinceSqlAlchemyResearchStoreis the owner of the feedback data, it's the ideal place for this logic. Consider removing the duplicated code from this file and importing the necessary functions/constants fromresearch_store.py.