mirror of
https://github.com/stablyai/orca.git
synced 2026-09-28 00:02:41 +00:00
Preserve configured-default intent through dialog agent changes
This commit is contained in:
@@ -134,7 +134,6 @@ export function normalizeLoadedGlobalSettings(
|
||||
// Why: rollback builds still read commitMessageAi, so refresh the legacy projection from sourceControlAi for compat.
|
||||
commitMessageAi: projectSourceControlAiToLegacyCommitMessageAi(
|
||||
migratedSourceControlAi,
|
||||
piConfiguredDefaultModelState,
|
||||
parsed.settings?.commitMessageAi ?? defaults.settings.commitMessageAi
|
||||
),
|
||||
voice: {
|
||||
|
||||
@@ -212,6 +212,17 @@ describe('buildCommitMessageGenerationParams', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('encodes configured default when switching the dialog to Pi', () => {
|
||||
expect(
|
||||
buildCommitMessageGenerationParams({
|
||||
agentId: 'pi',
|
||||
commandTemplate: '{basePrompt}',
|
||||
baseParams: null,
|
||||
settings: null
|
||||
})
|
||||
).toMatchObject({ model: 'github-copilot/gpt-5.4-mini', useConfiguredDefaultModel: true })
|
||||
})
|
||||
|
||||
it('preserves Pi configured-default intent through dialog reconstruction', () => {
|
||||
expect(
|
||||
buildCommitMessageGenerationParams({
|
||||
|
||||
+8
-4
@@ -1,5 +1,7 @@
|
||||
import {
|
||||
CUSTOM_AGENT_ID,
|
||||
PI_DEFAULT_MODEL_ID,
|
||||
PI_RETIRED_COPILOT_DEFAULT_MODEL_ID,
|
||||
getCommitMessageAgentCapability,
|
||||
isCustomAgentId
|
||||
} from '../../../../../../shared/commit-message-agent-spec'
|
||||
@@ -41,6 +43,10 @@ export function buildCommitMessageGenerationParams(args: {
|
||||
? args.baseParams.model
|
||||
: (capability.models.find((model) => model.id === capability.defaultModelId)?.id ??
|
||||
capability.defaultModelId)
|
||||
const useConfiguredDefaultModel =
|
||||
args.agentId === 'pi' &&
|
||||
(modelId === PI_DEFAULT_MODEL_ID ||
|
||||
(sameResolvedAgent && args.baseParams?.useConfiguredDefaultModel === true))
|
||||
const model = capability.models.find((candidate) => candidate.id === modelId)
|
||||
const thinkingLevel =
|
||||
sameResolvedAgent && args.baseParams?.thinkingLevel
|
||||
@@ -50,10 +56,8 @@ export function buildCommitMessageGenerationParams(args: {
|
||||
const customAgentCommand = args.baseParams?.customAgentCommand ?? args.customAgentCommand
|
||||
return {
|
||||
agentId: args.agentId,
|
||||
model: modelId,
|
||||
...(sameResolvedAgent && args.baseParams?.useConfiguredDefaultModel
|
||||
? { useConfiguredDefaultModel: true }
|
||||
: {}),
|
||||
model: useConfiguredDefaultModel ? PI_RETIRED_COPILOT_DEFAULT_MODEL_ID : modelId,
|
||||
...(useConfiguredDefaultModel ? { useConfiguredDefaultModel: true } : {}),
|
||||
...(thinkingLevel ? { thinkingLevel } : {}),
|
||||
commandInputTemplate: args.commandTemplate,
|
||||
...(args.agentArgs !== undefined ? { agentArgs: args.agentArgs } : {}),
|
||||
|
||||
@@ -220,7 +220,7 @@ export function resolveSourceControlAiForOperation(
|
||||
const model =
|
||||
spec.models.find((candidate) => candidate.id === persistedModelId) ??
|
||||
discoveredModels.find((candidate) => candidate.id === persistedModelId) ??
|
||||
(spec.modelSource === 'dynamic' && persistedModelId
|
||||
(spec.id === 'pi' && persistedModelId
|
||||
? { id: persistedModelId, label: persistedModelId }
|
||||
: undefined) ??
|
||||
getCommitMessageModel(resolvedAgent, spec.defaultModelId)
|
||||
|
||||
Reference in New Issue
Block a user