Skip to main content

Create Bot Empty Strategy + Language Support

Summary​

Updated Quantago so new bots can be created without selecting a strategy, then routed directly into the bot chat for AI-guided configuration. Added interface language preferences for English, Spanish, and Hungarian, and passed the selected language through to bot creation and chat so the assistant uses it as the default response language unless the user writes or asks in another language.

What changed​

  • Added frontend i18n setup with i18next and react-i18next.
  • Added persisted language preference state with supported languages: English, Spanish, Hungarian.
  • Added a language selector to Settings > Profile.
  • Localized the app shell, navigation, settings copy, new bot wizard copy, and bot chat placeholder/suggestions.
  • Localized the bot detail tab labels, date range drawer, chat header/sidebar labels, and the stop-bot decision dialog so the new bot chat page is more consistently localized after switching languages.
  • Reworked /bots/new into a fullscreen, three-step slide flow:
    1. Choose a name.
    2. Choose a strategy, with Empty strategy selected by default.
    3. Choose account and asset.
  • Removed the previous auto-select-first-strategy behavior.
  • Submit now sends strategy: "" for an empty strategy and navigates to /bots/:id/chat after creation.
  • Bot creation now accepts an optional preferredLanguage field.
  • Backend creates an initial bot conversation with a localized assistant greeting after bot creation.
  • Bot chat stream requests now include preferredLanguage, and the system prompt treats it as the default language for neutral or ambiguous messages while still honoring the language used by the user.
  • Fixed one unrelated hook dependency lint warning in MonitorPanel.tsx so full lint is clean.

Follow-up fixes from E2E​

Browser validation on the deployed dev build exposed a form-default edge case: when the footer Next button advanced from step 2 to step 3, React could reuse the same button node and the click could inherit the submit button's default action. The wizard now prevents the default action in the next-step handler and gives the next/create buttons separate keys so advancing to the final slide cannot accidentally start creation.

The same E2E pass exposed dev database drift: the deployed dev Worker was pointed at a database missing billing_accounts, so POST /api/bots failed before insert while checking bot-plan limits. The dev Worker DATABASE_URL secret was synced from the local dev env value and the dev API was redeployed. The target dev database already had the billing tables.

Key implementation notes​

Empty strategy is represented as an empty string, not null, because the existing bots.strategy column is non-nullable and the bot strategy snapshot seeding path already skips blank strategy names.

The creation greeting is persisted as the first assistant message in a new bot-scoped AI conversation so arriving on the chat page immediately shows guidance instead of an empty thread.

const strategyName = selected?.name ?? "";

const payload = {
name: name.trim() || `${primarySymbol || "New"} Bot`,
strategy: strategyName,
preferredLanguage: language,
parameters: {
...(selected ? { entryFrequency: selected.defaultFrequency } : {}),
...(selectedAccount ? { credentialId: selectedAccount.id } : {}),
},
};

Validation​

  • pnpm typecheck from projects/quantago: passed.
  • pnpm lint from projects/quantago: passed.
  • Checked frontend source for max-w-* classes below 4xl: none found in the changed frontend source.
  • VS Code diagnostics found no errors in the changed TypeScript files.
  • Dev API health: https://dev-api.quantago.co/api/health returned {"ok":true}.
  • Production API health: https://api.quantago.co/api/health returned {"ok":true}.
  • Dev and production frontends served the latest localized bundle.
  • Dev E2E: created a bot with the empty strategy selected by default, landed on /bots/:id/chat/:conversationId, and verified the seeded congratulatory chat greeting.
  • Dev Hungarian E2E: switched the UI language to Hungarian, created another empty-strategy bot, and verified the localized wizard plus Hungarian seeded chat greeting.
  • Production E2E: in an isolated browser context with a fresh test account, created an empty-strategy bot and verified POST /api/bots returned 201, navigation landed on /bots/:id/chat/:conversationId, and the seeded congratulatory chat greeting rendered.

Deployments​

  • Dev API Worker: quantago-dev-api, version d96b6189-00e4-4942-84ae-dfa4b0c8290e after syncing the dev DATABASE_URL secret.
  • Production API Worker: quantago-api, version 70cbe422-6b3a-4388-8753-62f903e11065.
  • Dev frontend Pages: quantago-dev-app, preview https://8769b058.quantago-dev-app.pages.dev.
  • Production frontend Pages: quantago-app, preview https://bf56d3c0.quantago-app.pages.dev.

Files touched​

  • services/frontend/src/i18n/*
  • services/frontend/src/store/preferences-store.ts
  • services/frontend/src/App.tsx
  • services/frontend/src/components/layout/main-nav/MainNav.tsx
  • services/frontend/src/routes/settings/SettingsPage.tsx
  • services/frontend/src/routes/bots/CreateBotPage.tsx
  • services/frontend/src/routes/bots/BotDetailPage.tsx
  • services/frontend/src/routes/bots/StopBotDialog.tsx
  • services/frontend/src/lib/api-client/index.ts
  • services/frontend/src/routes/bots/bots-api.ts
  • services/frontend/src/routes/bots/bots-store.ts
  • services/frontend/src/store/asyncWrapper.ts
  • services/frontend/src/store/index.ts
  • services/backend/src/routes/bots/bots-schema.ts
  • services/backend/src/routes/bots/bots-service.ts
  • services/backend/src/routes/bots/bots-chat-handlers.ts
  • services/backend/src/routes/bots/prompts/builder.ts
  • services/backend/src/routes/bots/prompts/language.ts
  • services/frontend/src/routes/bots/MonitorPanel.tsx