feat: Ask Quantic — always-present AI chat (+ informational AI framing, radar sort)#109
Merged
Conversation
The seven scoped portfolio tools have no Telegram coupling but lived in the Telegram namespace. Move them to Quantic.AI.PortfolioTools so both the Telegram bot and the (incoming) web chat widget can share them, and add payout_ratio to the tool quote context — the key dividend sustainability signal the per-stock summary already uses. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A sticky nested LiveView mounted once in Layouts.app, so a conversational assistant is present on every signed-in page and its conversation survives navigation. Reuses Quantic.AI.chat_as/3 + PortfolioTools (the same engine as the Telegram bot) — no new AI infrastructure. - Persists open state + conversation to localStorage (survives refresh and cross-session navigation). - Page-aware via a handle_params on_mount hook (QuanticWeb.AskContext). - Brand-emerald styling matching the logo gradient; attention pulse. - Demo accounts get a canned reply — never a paid provider call. - Informational framing only: describes a stock on dividend criteria, never a buy/sell recommendation, with an in-widget 'not financial advice' note. Seven languages. - HomePage showcase card + README/architecture docs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop the strong_buy→avoid verdict from stock_summary (schema, prompt,
system message, and the badge component + its now-dead helpers). Aligns
the feature with the app's own footer disclaimer ('not a recommendation
to buy or sell any security') and with the chat widget's informational
framing — present the data and trade-offs, let the user decide.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…to 5 A failure that never reached the provider (e.g. a missing API key) spent no money, so it no longer counts against the user's daily quota; real provider calls — success or provider-side error — still count. Also bump the default daily limit 3 → 5 (the test env is pinned to 3 so the rate-limit tests stay deterministic, independent of the prod default). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Move the radar controls (AI insights, public page, view toggle) out of the title row into a controls row below the search, matching the portfolio page, and add a persisted sort select — Opportunity (default), Symbol, Dividend yield, Dividend score — reusing the shared sort_select component. Also wires the Ask Quantic widget onto the radar page. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Under each chat answer, render <.stock_logo> chips for the stocks it mentions. The symbol set comes from the model's actual tool calls (ChatResult.tool_calls) — what the tools really returned — then narrowed to tickers present in the reply text. Reliable by construction: no regex-guessing tickers out of prose (which misfires on AI/EU/USD). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…rvations The portfolio/radar AI insights presented a directive 'Buying opportunities' section, which reads as a buy recommendation — the same issue the per-stock verdict removal addressed, and a contradiction of the app's 'not a recommendation to buy or sell' disclaimer. Rename the schema field buyingOpportunities -> observations (reason -> note), reword the prompts to describe what's notable without recommending a buy, drop the 'actionable' framing from the analyst system prompt, and relabel the UI section 'Worth noting' (neutral colour). Seven locales. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Promote Ask Quantic to its own README feature; correct the architecture AI section (5/day quota, record-on-real-call, demo no-provider, the not-financial-advice-by-construction stance, localStorage persistence, and tool-call-derived logo chips). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ask Quantic — an always-present AI chat
Adds a conversational AI assistant that's present on every signed-in page and answers natural-language questions about the user's portfolio, radar, and dividends. It reuses the existing chat engine (
Quantic.AI.chat_as/3+ the seven scoped tools the Telegram bot already uses) — no new AI infrastructure, no new runtime. Plain Elixir/Phoenix.What it does
Layouts.appas a sticky nested LiveView, so the conversation survives navigation between pages.localStorage, so they also survive a refresh or a cross-live_sessionnavigation.handle_paramson_mounthook (QuanticWeb.AskContext) broadcasts the current page over PubSub so answers can bias to what you're looking at.<.stock_logo>chips for the stocks it referenced, using the model's actualtool_calls(not a regex on prose).Safety & cost
Also in here
refactor(ai)— moved the seven tools out of the Telegram namespace toQuantic.AI.PortfolioTools(shared by both front doors) and addedpayout_ratioto the tool context.feat(radar)— aligned the radar toolbar with the portfolio page and added a persisted sort select (Opportunity / Symbol / Dividend yield / Dividend score).Commits
refactor(ai): move chat tools toQuantic.AI.PortfolioToolsfeat(ai): always-present Ask Quantic chat widgetrefactor(ai): make the per-stock AI summary informationalfeat(ai): don't charge quota for no-cost failures; raise daily limit to 5feat(radar): match the portfolio toolbar + add a sort selectfeat(ai): show logo chips for stocks an answer referencesrefactor(ai): reframe insights "Buying opportunities" as neutral observationsdocs: document the Ask Quantic chat widget + informational AI framingTesting
mix precommitgreen — 415 tests pass (compile warnings-as-errors, format, full suite). NewAskLiveTestcovers mount/availability, happy path, rate-limit, provider failure, multi-turn, persistence/restore, demo canned reply (no provider call), and logo chips.🤖 Generated with Claude Code