-
Notifications
You must be signed in to change notification settings - Fork 38
[Improve] Add trial inference choice to setup #1735
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
Closed
roomote-roomote
wants to merge
1
commit into
feat/free-trial-inference
from
improve/setup-trial-inference-flow
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
149 changes: 149 additions & 0 deletions
149
apps/web/src/app/(onboarding)/setup/StepConfigureInference.client.test.tsx
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
93 changes: 93 additions & 0 deletions
93
apps/web/src/app/(onboarding)/setup/StepConfigureInference.tsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| 'use client'; | ||
|
|
||
| import { useMutation, useQueryClient } from '@tanstack/react-query'; | ||
| import { Gift, Plug } from 'lucide-react'; | ||
| import { toast } from 'sonner'; | ||
|
|
||
| import { useTRPC } from '@/trpc/client'; | ||
| import { ArrowRight, Button, Spinner } from '@/components/system'; | ||
| import { cn } from '@/lib/utils'; | ||
|
|
||
| import { StepTitle } from './StepTitle'; | ||
| import { getSetupStepDefinition } from './types'; | ||
|
|
||
| const INFERENCE_STEP = getSetupStepDefinition('inference'); | ||
|
|
||
| export function StepConfigureInference({ | ||
| onUseTrial, | ||
| onConfigureProvider, | ||
| }: { | ||
| onUseTrial: () => void; | ||
| onConfigureProvider: () => void; | ||
| }) { | ||
| const trpc = useTRPC(); | ||
| const queryClient = useQueryClient(); | ||
| const chooseTrialInference = useMutation( | ||
| trpc.setupNew.chooseTrialInference.mutationOptions({ | ||
| onSuccess: async () => { | ||
| await queryClient.invalidateQueries({ | ||
| queryKey: trpc.setupNew.status.queryKey(), | ||
| }); | ||
| onUseTrial(); | ||
| }, | ||
| onError: (error) => toast.error(error.message), | ||
| }), | ||
| ); | ||
| const choiceButtonClassName = cn( | ||
| 'group flex w-full items-center gap-3 py-5', | ||
| 'hover:text-accent-foreground hover:bg-foreground', | ||
| ); | ||
|
|
||
| return ( | ||
| <div className="relative w-full max-w-2xl space-y-6 py-2 md:py-0"> | ||
| <StepTitle text={INFERENCE_STEP.title} /> | ||
| <div className="space-y-4 max-w-xl"> | ||
| <p> | ||
| Roomote needs a model provider for, you know, AI stuff. | ||
| <br /> | ||
| If you want, we can give you a few credits to try Roomote out or you | ||
| can configure your provider directly. | ||
| </p> | ||
|
|
||
| <div className="space-y-0.5 max-w-sm"> | ||
| <Button | ||
| type="button" | ||
| size="sm" | ||
| variant="default" | ||
| className={choiceButtonClassName} | ||
| disabled={chooseTrialInference.isPending} | ||
| onClick={() => chooseTrialInference.mutate()} | ||
| > | ||
| {chooseTrialInference.isPending ? ( | ||
| <Spinner /> | ||
| ) : ( | ||
| <Gift className="size-4 shrink-0" /> | ||
| )} | ||
| <span className="font-medium grow text-left"> | ||
| Use free Roomote trial inference | ||
| </span> | ||
| <ArrowRight /> | ||
| </Button> | ||
| <Button | ||
| type="button" | ||
| size="sm" | ||
| variant="default" | ||
| className={choiceButtonClassName} | ||
| disabled={chooseTrialInference.isPending} | ||
| onClick={onConfigureProvider} | ||
| > | ||
| <Plug className="size-4 shrink-0" /> | ||
| <span className="font-medium grow text-left"> | ||
| Configure your provider | ||
| </span> | ||
| <ArrowRight /> | ||
| </Button> | ||
| </div> | ||
|
|
||
| <p className="text-sm text-foreground/50"> | ||
| Roomote trial inference goes through OpenRouter. | ||
| </p> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
40 changes: 1 addition & 39 deletions
40
apps/web/src/app/(onboarding)/setup/StepInferenceProvider.client.test.tsx
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
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.
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 new inference choice has no
onBackprop orSetupFooter, and this call does not pass one. In the communication-auth flow,inferencefollows the Slack step, so trial-enabled users can no longer navigate back to Slack from this screen (unlike the replaced provider step). PasscanGoBack ? goToPreviousStep : undefinedthrough and render the Back footer.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.
Addressed in the consolidated successor branch for #1710 at
2d248f58: the choice rendersSetupFooter, receivesgoToPreviousStep, and has component plus flow coverage. This stacked PR is being superseded rather than updated independently.