Replace ChatGPT help with streaming AI assistant conversations - #9274
Open
iHiD wants to merge 2 commits into
Open
Replace ChatGPT help with streaming AI assistant conversations#9274iHiD wants to merge 2 commits into
iHiD wants to merge 2 commits into
Conversation
Add a version component to the landing page etag so cached responses are invalidated. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QCkfS91ZjSLcGmbDehDAeH
Shifts the editor's AI help to the same model as Jiki's: the browser talks directly to a Cloudflare Worker (exercism/llm-chat-proxy) which streams Socratic-mentor responses from Gemini, instead of the old fire-and-forget ChatGPT proxy + ActionCable round-trip. Rails now: - mints short-lived per-solution conversation JWTs (Turnstile-gated) - enforces entitlement: Insiders unlimited; everyone else gets one free exercise conversation, ever (pinned to their first) - serves the exercise context (instructions, tests) to the worker, authenticated by the same JWT - persists conversations, verifying an HMAC signature over each assistant message so clients can't fabricate them The editor gains a multi-turn streaming chat panel replacing the old single-shot ChatGPT panel, and the ChatGPT pipeline (commands, SPI callback, ActionCable channel, usage counters, reset job) is removed. Requires (exercism-config): assistant_chat_jwt_secret, assistant_chat_hmac_secret, and assistant_chat_url. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJjLSVfCaDvJQM3oATNcL6
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.
Shifts the editor's AI help to the same model as Jiki's llm-chat-proxy: the browser talks directly to a Cloudflare Worker (exercism/llm-chat-proxy) which streams Socratic-mentor responses from Gemini, replacing the old fire-and-forget ChatGPT proxy + SPI callback + ActionCable round-trip.
Entitlement model
Rails
Solution::AssistantConversationmodel (JSON messages column, unique per solution) + Mandate commands mirroring Jiki's:CreateConversationToken(1h HS256 JWT bound to the solution),CheckUserAccess,FindOrCreate,AddUserMessage,AddAssistantMessage,AddMessage,VerifyHMAC,VerifyConversationToken.POST /api/v2/solutions/:uuid/assistant_conversationmints tokens, gated by Cloudflare Turnstile (Captcha::VerifyTurnstileToken, fail-open on CF outage).user_messages/assistant_messagespersist the transcript; assistant messages must carry a valid HMAC signature from the worker (payload includes the solution uuid and a 10-minute freshness window, closing Jiki's replay gap).GET /api/v2/solutions/:uuid/assistant_contextserves instructions + tests to the worker, authenticated with the same conversation JWT.Front-end
editor/AssistantChatmodule ported from Jiki: streaming chat panel with token caching (one Turnstile pass per session), transparent refresh on token expiry, usage warnings at 90%, cap/upsell states, and free-conversation upsell for non-insiders.Stuck?button now routes to the assistant tab for everyone.Removed
The entire legacy pipeline:
Submission::AI::ChatGPT::*, the ai_help endpoint,/spi/chatgpt_responses,Submission::AIHelpRecordsChannel,ResetChatGPTUsageJob+ schedule, chatgpt usage counters, and the ChatGptFeedback components. Thesubmission_ai_help_recordstable is left in place (nothing reads it). The OpenAI training-data/tagging pipeline is untouched.Requires before deploy
assistant_chat_jwt_secret,assistant_chat_hmac_secret(secrets, shared with the worker) andassistant_chat_url(config; prodhttps://chat.exercism.org, localhttp://local.exercism.io:3027).🤖 Generated with Claude Code
https://claude.ai/code/session_01WJjLSVfCaDvJQM3oATNcL6