Skip to content

new central AI config#2351

Merged
Mbeaulne merged 2 commits into
masterfrom
06-03-new_central_ai_config
Jun 5, 2026
Merged

new central AI config#2351
Mbeaulne merged 2 commits into
masterfrom
06-03-new_central_ai_config

Conversation

@Mbeaulne

@Mbeaulne Mbeaulne commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Description

Replaces the hardcoded aiAssistantConfig.json and single-token proxy model with a unified bring-your-own-provider configuration (AiProviderConfig) that is stored in localStorage under tangle.aiProvider.config and shared across all AI features (AI assistant, component search reranking, and component description generation).

Key changes:

  • Introduces src/types/aiProvider.ts with the shared AiProviderConfig interface (apiBase, apiKey, model), all of which are now optional except apiBase.
  • Removes src/config/aiAssistantConfig.json, src/agent/aiTokenStore.ts, and src/hooks/useComponentSearchSettings.ts. Their responsibilities are absorbed by the new useAiProviderSettings hook (tangle.aiProvider.config storage key) which falls back to the legacy tangle.componentSearchV2.config key and migrates the old thinkingModel field.
  • isConfigured now only requires apiBase to be non-empty; apiKey and model are optional to support proxy setups that own authentication and model selection.
  • ProxyClient.ensureConfigured now accepts AiProviderConfig instead of a raw token string. When apiKey is blank, the Authorization header is stripped from outgoing requests via a custom fetch wrapper.
  • All agents (tangleDispatcher, debugAssistant, generalHelp, pipelineArchitect, pipelineRepair) now receive model configuration via getAgentModelConfig(session.aiConfig) spread into the agent constructor, replacing the requireOrchestratorModel / requireSubagentModel calls.
  • AgentSession carries aiConfig so every agent and tool has access to the provider config without touching module-global state.
  • The AiTokenSetup component is replaced by AiProviderSetup, which links to the settings page instead of prompting for a raw token.
  • The Settings sidebar "AI Configuration" entry is now shown when either the component-search-v2 or ai-assistant feature flag is enabled.
  • Validation in AgentSettings and naturalLanguageComponentSearchService is relaxed to require only apiBase; API requests omit the Authorization header and model field when those values are blank.
  • Embedding model and skills base URL are now derived from constants rather than the deleted config file.

Related Issue and Pull requests

Type of Change

  • Bug fix
  • New feature
  • Improvement
  • Cleanup/Refactor
  • Breaking change
  • Documentation update

Checklist

  • I have tested this does not break current pipelines / runs functionality
  • I have tested the changes on staging

Screenshots (if applicable)

Test Instructions

  1. Open Settings → AI Configuration and verify the page is accessible when either component-search-v2 or ai-assistant is enabled.
  2. Enter only an API base URL (leave API key and model blank) and click Save — confirm it saves successfully and isConfigured becomes true.
  3. Open the AI assistant panel and confirm it shows the AiProviderSetup prompt (link to settings) when no provider is configured, and loads the chat interface once configured.
  4. Verify AI component search reranking and description generation work with a proxy that does not require an API key or explicit model selection.
  5. Confirm that existing localStorage data under tangle.componentSearchV2.config is read correctly as a fallback and that thinkingModel is migrated to model.

Additional Comments

The tangle.componentSearchV2.config key is still read as a fallback but is removed from localStorage on the next clear() call. No explicit one-time migration is performed; the fallback read handles existing users transparently.

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

🎩 Preview

A preview build has been created at: 06-03-new_central_ai_config/64e23f3

@Mbeaulne Mbeaulne marked this pull request as ready for review June 3, 2026 15:29
@Mbeaulne Mbeaulne requested a review from a team as a code owner June 3, 2026 15:29

@morgan-wowk morgan-wowk left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI-assisted review — one finding on AI config migration/fallback.

Comment thread src/hooks/useAiProviderSettings.ts
@Mbeaulne Mbeaulne force-pushed the 05-28-component_description branch from 6d1148f to f45f4ff Compare June 4, 2026 20:43
@Mbeaulne Mbeaulne force-pushed the 06-03-new_central_ai_config branch from e26d2d4 to 192afb4 Compare June 4, 2026 20:43
@Mbeaulne Mbeaulne force-pushed the 05-28-component_description branch from f45f4ff to e3d54e8 Compare June 4, 2026 20:52
@Mbeaulne Mbeaulne force-pushed the 06-03-new_central_ai_config branch 2 times, most recently from 5cc28c3 to dcda267 Compare June 4, 2026 21:03
@Mbeaulne Mbeaulne force-pushed the 05-28-component_description branch 2 times, most recently from 64ad138 to 2e44870 Compare June 4, 2026 21:29
@Mbeaulne Mbeaulne force-pushed the 06-03-new_central_ai_config branch 2 times, most recently from 113c315 to 641682c Compare June 4, 2026 21:46
@Mbeaulne Mbeaulne force-pushed the 05-28-component_description branch from 2e44870 to 05fecb2 Compare June 4, 2026 21:46
Comment thread src/hooks/useAiProviderSettings.ts
Comment thread src/routes/v2/pages/Editor/components/AiChat/components/AiProviderSetup.tsx Outdated
Comment thread src/agent/config.ts Outdated
@Mbeaulne Mbeaulne force-pushed the 05-28-component_description branch from 014a78e to 3219213 Compare June 5, 2026 02:04
@Mbeaulne Mbeaulne force-pushed the 06-03-new_central_ai_config branch from dd55cdd to cbc77c2 Compare June 5, 2026 11:54
@Mbeaulne Mbeaulne force-pushed the 05-28-component_description branch 2 times, most recently from a413182 to e7028c0 Compare June 5, 2026 12:06
@Mbeaulne Mbeaulne force-pushed the 06-03-new_central_ai_config branch 2 times, most recently from 4e24f5b to a5f79e9 Compare June 5, 2026 12:29
@Mbeaulne Mbeaulne force-pushed the 05-28-component_description branch 2 times, most recently from a66b440 to d7ea616 Compare June 5, 2026 12:41
@Mbeaulne Mbeaulne force-pushed the 06-03-new_central_ai_config branch from a5f79e9 to 44d756c Compare June 5, 2026 12:41
@Mbeaulne Mbeaulne force-pushed the 05-28-component_description branch from d7ea616 to 293f685 Compare June 5, 2026 13:40
@Mbeaulne Mbeaulne force-pushed the 06-03-new_central_ai_config branch 3 times, most recently from df8545e to e1bcfa8 Compare June 5, 2026 14:21
@Mbeaulne Mbeaulne force-pushed the 05-28-component_description branch 2 times, most recently from 1d7643e to a2a024a Compare June 5, 2026 14:31
@Mbeaulne Mbeaulne force-pushed the 06-03-new_central_ai_config branch from e1bcfa8 to fe0c0df Compare June 5, 2026 14:31
@Mbeaulne Mbeaulne requested review from camielvs and morgan-wowk June 5, 2026 14:35
@Mbeaulne Mbeaulne force-pushed the 06-03-new_central_ai_config branch from fe0c0df to e9fb75d Compare June 5, 2026 17:38
@Mbeaulne Mbeaulne force-pushed the 05-28-component_description branch from a2a024a to 3defa6e Compare June 5, 2026 17:38

Mbeaulne commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator Author

Merge activity

  • Jun 5, 5:42 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jun 5, 5:59 PM UTC: Graphite rebased this pull request as part of a merge.
  • Jun 5, 6:03 PM UTC: @Mbeaulne merged this pull request with Graphite.

@Mbeaulne Mbeaulne changed the base branch from 05-28-component_description to graphite-base/2351 June 5, 2026 17:53
@Mbeaulne Mbeaulne changed the base branch from graphite-base/2351 to master June 5, 2026 17:57
Mbeaulne and others added 2 commits June 5, 2026 17:58
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@Mbeaulne Mbeaulne force-pushed the 06-03-new_central_ai_config branch from e9fb75d to 64e23f3 Compare June 5, 2026 17:58
@Mbeaulne Mbeaulne merged commit af5bf89 into master Jun 5, 2026
17 checks passed
@Mbeaulne Mbeaulne deleted the 06-03-new_central_ai_config branch June 5, 2026 18:03
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.

3 participants