Files
orca/tests/tools/omp-source-control-ui/fixture.tsx
T
Neilandunknown 4dec64d533 feat(source-control-ai): support OMP generation (#20624)
* feat(source-control-ai): support OMP text generation

Read prompts on stdin, retain OMP configured model by default, and reuse JSON model discovery.

Co-authored-by: unknown <1784931579@qq.com>

* test(source-control-ai): cover OMP large input and model overrides

* fix(omp): keep configured model default out of discovered catalog

* fix(omp): hide config default from model discovery catalog

* fix(omp): separate terminal discovery from generation defaults

* test(omp): keep model probe import compatible with CLI typecheck

* test: align Source Control AI registry contracts with OMP

---------

Co-authored-by: unknown <1784931579@qq.com>
2026-09-19 01:54:50 -07:00

47 lines
1.6 KiB
TypeScript

import React from 'react'
import { createRoot } from 'react-dom/client'
import { getDefaultSettings } from '../../../src/shared/constants'
import type { GlobalSettings } from '../../../src/shared/global-settings-types'
import { CommitMessageAiPane } from '../../../src/renderer/src/components/settings/CommitMessageAiPane'
import { TooltipProvider } from '../../../src/renderer/src/components/ui/tooltip'
import { useAppStore } from '../../../src/renderer/src/store'
import './fixture.css'
const settings = getDefaultSettings('/disposable-omp-ui-home')
settings.sourceControlAi = {
enabled: true,
agentId: null,
selectedModelByAgent: {},
selectedThinkingByModel: {},
instructionsByOperation: {},
actions: {},
customAgentCommand: ''
}
const updateSettings = async (patch: Partial<GlobalSettings>): Promise<void> => {
const current = useAppStore.getState().settings
if (!current) {
throw new Error('Settings fixture not initialized')
}
useAppStore.setState({ settings: { ...current, ...patch } })
}
useAppStore.setState({ settings, repos: [], settingsSearchQuery: '', updateSettings })
function Fixture(): React.JSX.Element {
const current = useAppStore((state) => state.settings)
if (!current) {
throw new Error('Missing fixture settings')
}
return (
<TooltipProvider>
<main className="mx-auto max-w-4xl p-6">
<CommitMessageAiPane settings={current} updateSettings={updateSettings} />
</main>
</TooltipProvider>
)
}
const root = document.getElementById('root')
if (!root) {
throw new Error('Missing fixture root')
}
createRoot(root).render(<Fixture />)