Personal Finance AI #1985
Reference in New Issue
Block a user
Delete Branch "ai"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
We should add this to
.gitignoreas it will change frequentlyCan we move this over to
tailwind/application.cssand delete this file entirely? (after v4 upgrade I don't think we need this at all)When using the chat, I ran into an application error pretty much any time I asked about IncomeStatement items that had a period:
Should we drop this route / controller / view for the moment?
I ran into several issues here and I'm not sure how critical it is to have. Seems like we could simplify the overall feature by removing this and sticking with the sidebar chat only.
@@ -0,0 +18,4 @@<p class="text-gray-600 mb-6 text-sm">NOTE: During beta testing, we'll be monitoring usage and AI conversations to improve the assistant.</p>We should probably remove this for self hosted users as we won't have any way of monitoring usage and I wouldn't want any self hosted users getting the wrong impression.
@@ -11,0 +14,4 @@member dopost :clearendendJust a suggestion, but as I mentioned above, I feel like for this first pass we could remove the following entirely:
Since
user_idhas a clear relationship with family, I think we can remove thisfamily_idFK. If we need to access family chats, I'd just set that up directly through users:Is this controller used at all? I think we can delete it?
After spending some more time understanding the overall flow, I think this may be one of the bigger areas with an opportunity to simplify and make the overall view organization a bit clearer with Turbo frames.
Right now, we're putting a ton of view logic in the layout, which I think we should consolidate into the
app/views/chatsdirectory and leverage Turbo frames. My main concern is that we're loading the chat on every request, and for longer chats, this will incur a performance hit on every page.I'm imagining the layout could just be consolidated in
application.html.erbto:Then all of the AI related stuff would go in
views/chats, andindex.html.erbeffectively becomes what is the_ai_sidebar.html.erbright now. This will have several benefits:indexview into one and aligns better with the domain by putting all the view logic inviews/chats/So in summary, here's the view organization that I'm imagining for the entire feature:
views/layouts/application.html.erbchats/chat_navturbo_frame_tag "chats", src: chats_pathviews/chats/_chat_nav.html.erb- a shared partial, rendered at top ofindexandshowfor navigation of chats_chat.html.erb- for list view_chat_consent.html.erb_chat_greeting.html.erb_chat_form.html.erb- better aligns with an entire "chat"index.html.erb_chat_consent_chat.html.erbpartials for usershow.html.erb_chat_greetingmessages/_message.html.erbpartials_chat_formviews/messages_message.html.erbCould we remove
user_idandinternaland representMessageas this?While reading through, it was a little hard to understand how
role,internal, anduser_idwere playing together. With the model above, I think it becomes easier to reason about:user- this message came from a Maybe userassistant- this message came from OpenAI as a direct response to a user messagesystem- messages used for giving context to OpenAI, but invisible to the user in the UIdebug_mode: true- a completely separate and explicit concept indicating that this system message is debug only and shouldn't be shown.Then in our
Messagemodel, the scope used in the view becomes a bit clearer:I'm thinking to start out, this file can be reduced quite a bit as just a simple sanity check on the interface:
I went ahead and mocked this up to see how it would look. Here's the branch and demo:
https://github.com/maybe-finance/maybe/compare/main...zachgoll/ai-skeleton
data-turbo-permanentso it doesn't reload the frames on each navigationniland the next page load will show "all chats" againhttps://github.com/user-attachments/assets/c08b19c8-9c4e-4f15-83b7-6ab04c912d1e
#2022 is a direct checkout of this branch with some additional documentation added, so closing this one out and will use #2022 for final merge.
Pull request closed