Implement like heart feature and AI feedback context#26
Implement like heart feature and AI feedback context#26SeunFashina002 wants to merge 6 commits intoTopFlight-Digital:masterfrom
Conversation
v1olen
left a comment
There was a problem hiding this comment.
I've found so nice-to-fix bits, reckon there's a few more things that would be good to tweak but the formatter thing (I've mentioned in the comment) make it harder to review. Would be nice if you could get rid of this formatting changes so I can do a second round later :)
| title: string; | ||
| description: string; | ||
| } | ||
| }; |
There was a problem hiding this comment.
It seems that you have some extra linter (like prettier or sth else) enabled, could you disable it for this project? There's a lot of formatting changes in this PR that will probably get reverted when other person will work on these files; it'll lead to battle of linters leaving post-battle wrecks in every PR 😄
We use eslint for code formatting (planning to migrate to stylistic in the future), feel free to run it from cli on the entire codebase at the very end and keep in a separate commit, then just enable it in your IDE
backend/package-lock.json
Outdated
| @@ -0,0 +1,2900 @@ | |||
| { | |||
There was a problem hiding this comment.
We generally use pnpm, rather than npm. Let's don't keep two types of lock files in the codebase
vite.config.ts
Outdated
| export default defineConfig({ | ||
| define: { | ||
| API_SERVER_URL: JSON.stringify(``), | ||
| API_SERVER_URL: JSON.stringify(`http://localhost:4000`), |
There was a problem hiding this comment.
Would be good to finally split it to .env file, but up to you, we can also do it later
| <svg | ||
| v-if="props.liked" | ||
| width="24" | ||
| height="24" | ||
| viewBox="0 0 24 24" | ||
| fill="white" | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| > | ||
| <path | ||
| d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41 0.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z" | ||
| /> | ||
| </svg> | ||
| <svg | ||
| v-else | ||
| width="24" | ||
| height="24" | ||
| viewBox="0 0 24 24" | ||
| fill="none" | ||
| stroke="white" | ||
| stroke-width="2" | ||
| stroke-linecap="round" | ||
| stroke-linejoin="round" | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| > | ||
| <path | ||
| d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41 0.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z" | ||
| /> | ||
| </svg> |
There was a problem hiding this comment.
Please move the icon to a separate component
| :index="index + 1" | ||
| :title="item.title" | ||
| :subtitle="item.description" | ||
| :liked="isLiked(item.title)" |
There was a problem hiding this comment.
I don't remember atm but don't we have any more suitable field to identify a single hypothesis by?
src/views/hypotheses/index.vue
Outdated
| // If currently liked, remove from Map (unlike) | ||
| likedHypotheses.value.delete(title); | ||
| } else { | ||
| // If not liked, set to true (like) |
There was a problem hiding this comment.
Don't you think this code here is pretty self-explanatory? We usually stick to a rule that "comments are apologies", while this piece of code doesn't need to apologise, these comment seem to be typical this-is-a-stop-sign comments 😄
src/views/hypotheses/index.vue
Outdated
| read: (v) => new Map(JSON.parse(v || "[]")), | ||
| write: (v) => JSON.stringify(Array.from(v.entries())), |
There was a problem hiding this comment.
We usually try to not use single letters to name variables
src/views/hypotheses/index.vue
Outdated
| ); | ||
|
|
||
| function isLiked(title: string) { | ||
| return likedHypotheses.value.get(title) === true; |
There was a problem hiding this comment.
| return likedHypotheses.value.get(title) === true; | |
| return likedHypotheses.value.get(title); |
src/composables/bloc.ts
Outdated
| const prev = (bloc.hypotheses || []).find( | ||
| (h: Hypothesis) => h.title === title, | ||
| ); |
There was a problem hiding this comment.
We usually try to not use single letters or abbrs to name variables
src/composables/bloc.ts
Outdated
| const missingLiked = ( | ||
| JSON.parse(localStorage.getItem("liked.hypotheses") || "[]") as [ | ||
| string, | ||
| boolean, | ||
| ][] | ||
| ) | ||
| .filter( | ||
| ([title, liked]) => | ||
| liked && !results.some((h: Hypothesis) => h.title === title), | ||
| ) | ||
| .map(([title]) => { | ||
| // Try to find the last known version in previous hypotheses | ||
| const prev = (bloc.hypotheses || []).find( | ||
| (h: Hypothesis) => h.title === title, | ||
| ); | ||
| return prev || { title, description: "(Previously liked idea)" }; | ||
| }); |
There was a problem hiding this comment.
Even though it's possible to understand, would be good to decrease a cognitive load needed to do so 😄
Could you replace it with an easy-to-read procedural logic based on for..of loop?
|
Saw a comment @v1olen where you asked if the pr contains generation of tailors ideas based on the liked idea. I can't find the comment again, but yeah, it does.
…On Fri, Jun 20, 2025, 9:07 AM v1olen ***@***.***> wrote:
*v1olen* left a comment (TopFlight-Digital/optipilot#26)
<#26 (comment)>
Also, one question, following-up the roadmap task:
Include a “like heart feature” where users can mark their favourite ideas. When the user then gives feedback and performs a re-scan, these ideas will persist in the list and perhaps generate more tailored ideas based on the “liked ideas”.
the PR doesn't implement the perhaps generate more tailored ideas based
on the “liked ideas” part right? That's totally okay if not just let me
know so we will split this feature into two separate ones
—
Reply to this email directly, view it on GitHub
<#26 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AWDUZXLFUEPR7FDZXPEEW7D3EO6NLAVCNFSM6AAAAAB7S73ZRCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSOJQGIYDIMBTGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Yea, I see, I missed that and therefore removed the comment. All good, thanks :) |
|
Will work on all the changes you mentioned @v1olen , and yeah, I will get rid of that formatter 😅. Sorry about that! |
d06e7ad to
e8d6e61
Compare
|
@v1olen I've made changes to the code blocks you highlighted. As for the formatter, I've disabled prettier and I tried using lint:fix to force my code to follow the rules specified in the .eslintrc file before pushing this time. Does that help in any way to review smoothly? |
🚀 Feature: Like Heart & AI Feedback Context
Summary
This PR implements the "like heart" feature for hypotheses (A/B test ideas) and enhances idea generation by sending liked ideas as context to the AI, as outlined in the project roadmap.
What’s Included
How It Works
Why This Matters
Notes