Skip to content

App: connect your own AI before using OpenBot Cloud - #1997

Open
davidmckayv wants to merge 1 commit into
mainfrom
cloud-connect-your-ai-screens
Open

davidmckayv wants to merge 1 commit into
mainfrom
cloud-connect-your-ai-screens

Conversation

@davidmckayv

Copy link
Copy Markdown
Contributor

OpenBot Cloud provides no AI, so each person connects their own, personal to them and never shared with their organization. Today a new person goes from Welcome straight into chat, and their first message fails with a sentence telling an admin to add a key. This puts the screens in front of that, on the API from #1996.

What a person sees

  • Onboarding: a Connect your AI step right after Welcome, shown only when the server says one is required and the person's runs have none (required && uses === "none"). The step's button stays disabled until they connect, and there is no Not now. If the organization already has an AI, there is no step, and they can add their own later in Settings.
  • The gate: _authed sends anybody in that state to /onboarding?step=ai from any page. That includes people who finished onboarding before the step existed. For them it is the only step, and its button takes them into the app without finishing onboarding again.
  • Settings > General > Your AI: shows the person's own connection, or that Bots use the organization's, and opens the same chooser to add or change it. Removing theirs goes back to the organization's AI, or back to the step if the organization has none. Beside it, the admin's section now reads Organization's AI.
  • Chat: a run refused with Connect your AI to use Bots. An admin can also set one up for everyone in your organization. (matched word for word, exported beside NO_AI_CONNECTION) gets a Connect your AI button that opens the step. The self-hosted NO_AI_CONNECTION path is unchanged.

The chooser

Settings' AI connection chooser (the app's port of Desktop's setup window) moves to components/settings/ai-connection-chooser.tsx, and Settings' organization dialog and the new personal mode both use it. Organization mode works as it did before. In personal mode:

  • Every provider can connect with a key or an address.
  • A provider sign-in is offered only for providers in signIns, and it comes first. The server runs it: start, show the code and "Open the sign-in page", poll every interval seconds, then connect with useSavedKey and the preset address and model.
  • Plans and Desktop-held sign-ins are never offered, even inside OpenBot Desktop, because the server runs the Bots.

On a page, the chooser sits in a card where the other steps put their picture: a real control, so it has the card's fill, like the booking calendar.

Reads and writes go through lib/ai-connection factories: personalAiConnectionQueryOptions, connectPersonalAiMutationOptions, removePersonalAiMutationOptions, and plain functions for the sign-in. An error or a 404 from an older server reads as "not required".

Tests

  • app/tests/connect-your-ai.test.tsx (real browser, added to CI's app-browser job) drives the app's own gate, onboarding route and Settings against the spec's own examples. Every request body is checked with the generated zod schemas. It covers:
    • a new person held at the step until they connect, with a refused key, the gate sending them back, then a good key taking them in;
    • an organization with an AI going straight in;
    • a person who already finished onboarding getting only the step;
    • inside a fake Desktop shell: no plan tab, and the Unbiased AI server sign-in;
    • Settings > Your AI, including Remove.
  • add-model-key-link.test.tsx: the Cloud sentence gives everybody Connect your AI.
  • Existing onboarding, Settings, AI connection (including the org dialog's browser test) and copy tests pass. Typecheck, lint and format are clean.

Screenshots of the step and Settings in light and dark, at 1440px and 390px, were compared side by side with onboarding's Welcome and Settings' AI connection dialog.

OpenBot Cloud provides no AI, so each person connects their own, personal
to them and never shared with their organization. Until now a new person
went from Welcome into chat, and their first message failed with a
sentence telling an admin to add a key.

- Onboarding: a Connect your AI step right after Welcome, only where the
  server says one is required and the person's runs have none. Its button
  stays disabled until they connect, and there is no way past it. Where
  the organization already has an AI there is no step.
- The signed-in gate sends anybody in that state to the step from
  anywhere, including people who finished onboarding before it existed,
  for whom it is the only step and its button takes them into the app.
- Settings: a Your AI section with their own connection, or that Bots use
  the organization's, to add, change or remove theirs. The admin's
  section reads Organization's AI beside it.
- Chat: a run refused with the Cloud sentence gets a Connect your AI
  button that opens the step.
- The chooser from Settings' AI connection dialog is now shared, with a
  personal mode: a key or an address for every provider, and a provider
  sign-in only where the server runs it itself, polled until approved and
  connected with the key the server kept. Never a plan or a sign-in held
  by OpenBot Desktop, even inside Desktop. The organization dialog
  behaves as before.
- A real-browser test drives the gate, the step, Settings and the
  Desktop case against the spec's own examples, and runs in CI.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant