make it so model does not change during agent mode even if user switches

This commit is contained in:
Andrew Pareles 2025-03-07 22:55:06 -08:00
parent c42a782bde
commit b5dbd42eed
11 changed files with 89 additions and 77 deletions

View file

@ -19,6 +19,8 @@ import { extractCodeFromRegular } from './helpers/extractCodeFromResult.js';
import { registerWorkbenchContribution2, WorkbenchPhase } from '../../../common/contributions.js';
import { ILLMMessageService } from '../common/llmMessageService.js';
import { isWindows } from '../../../../base/common/platform.js';
import { IVoidSettingsService } from '../common/voidSettingsService.js';
import { FeatureName } from '../common/voidSettingsTypes.js';
// import { IContextGatheringService } from './contextGatheringService.js';
@ -788,8 +790,14 @@ export class AutocompleteService extends Disposable implements IAutocompleteServ
console.log('starting autocomplete...', predictionType)
const featureName: FeatureName = 'Autocomplete'
const modelSelection = this._settingsService.state.modelSelectionOfFeature[featureName]
const modelSelectionOptions = modelSelection ? this._settingsService.state.optionsOfModelSelection[modelSelection.providerName]?.[modelSelection.modelName] : undefined
const isEnabled = this._settingsService.state.globalSettings.enableAutocomplete
// set parameters of `newAutocompletion` appropriately
newAutocompletion.llmPromise = new Promise((resolve, reject) => {
newAutocompletion.llmPromise = isEnabled ? new Promise((resolve, reject) => reject('Autocomplete is disabled')) : new Promise((resolve, reject) => {
const requestId = this._llmMessageService.sendLLMMessage({
messagesType: 'FIMMessage',
@ -798,7 +806,8 @@ export class AutocompleteService extends Disposable implements IAutocompleteServ
suffix: llmSuffix,
stopTokens: stopTokens,
},
useProviderFor: 'Autocomplete',
modelSelection,
modelSelectionOptions,
logging: { loggingName: 'Autocomplete' },
onText: () => { }, // unused in FIMMessage
// onText: async ({ fullText, newText }) => {
@ -882,6 +891,7 @@ export class AutocompleteService extends Disposable implements IAutocompleteServ
@ILLMMessageService private readonly _llmMessageService: ILLMMessageService,
@IEditorService private readonly _editorService: IEditorService,
@IModelService private readonly _modelService: IModelService,
@IVoidSettingsService private readonly _settingsService: IVoidSettingsService,
// @IContextGatheringService private readonly _contextGatheringService: IContextGatheringService,
) {
super()

View file

@ -19,7 +19,8 @@ import { IWorkspaceContextService } from '../../../../platform/workspace/common/
import { IVoidFileService } from '../common/voidFileService.js';
import { generateUuid } from '../../../../base/common/uuid.js';
import { getErrorMessage } from '../../../../base/common/errors.js';
import { ChatMode } from '../common/voidSettingsTypes.js';
import { ChatMode, FeatureName } from '../common/voidSettingsTypes.js';
import { IVoidSettingsService } from '../common/voidSettingsService.js';
const findLastIndex = <T>(arr: T[], condition: (t: T) => boolean): number => {
@ -172,7 +173,11 @@ const newThreadObject = () => {
} satisfies ChatThreads[string]
}
export const THREAD_STORAGE_KEY = 'void.chatThreadStorage'
// past values:
// 'void.chatThreadStorage'
export const THREAD_STORAGE_KEY = 'void.chatThreadStorageI'
export interface IChatThreadService {
@ -237,6 +242,7 @@ class ChatThreadService extends Disposable implements IChatThreadService {
@ILLMMessageService private readonly _llmMessageService: ILLMMessageService,
@IToolsService private readonly _toolsService: IToolsService,
@IWorkspaceContextService private readonly _workspaceContextService: IWorkspaceContextService,
@IVoidSettingsService private readonly _settingsService: IVoidSettingsService,
) {
super()
this.state = { allThreads: {}, currentThreadId: null as unknown as string } // default state
@ -383,6 +389,12 @@ class ChatThreadService extends Disposable implements IChatThreadService {
: chatMode === 'agent' ? Object.keys(voidTools).map(toolName => voidTools[toolName as ToolName])
: undefined)
// these settings should not change throughout the loop (eg anthropic breaks if you change its thinking mode and it's using tools)
const featureName: FeatureName = 'Chat'
const modelSelection = this._settingsService.state.modelSelectionOfFeature[featureName]
const modelSelectionOptions = modelSelection ? this._settingsService.state.optionsOfModelSelection[modelSelection.providerName]?.[modelSelection.modelName] : undefined
// agent loop
const agentLoop = async () => {
@ -413,14 +425,14 @@ class ChatThreadService extends Disposable implements IChatThreadService {
...messages_.slice(lastUserMsgIdx + 1, Infinity),
]
const llmCancelToken = this._llmMessageService.sendLLMMessage({
messagesType: 'chatMessages',
useProviderFor: 'Ctrl+L',
logging: { loggingName: `Agent` },
messages,
tools: tools,
modelSelection,
modelSelectionOptions,
logging: { loggingName: `Agent` },
onText: ({ fullText, fullReasoning }) => {
this._setStreamState(threadId, { messageSoFar: fullText, reasoningSoFar: fullReasoning })
},

View file

@ -43,6 +43,8 @@ import { LLMChatMessage, OnError, errorDetails } from '../common/llmMessageTypes
import { IMetricsService } from '../common/metricsService.js';
import { IVoidFileService } from '../common/voidFileService.js';
import { IEditCodeService, URIStreamState, AddCtrlKOpts, StartApplyingOpts } from './editCodeServiceInterface.js';
import { IVoidSettingsService } from '../common/voidSettingsService.js';
import { FeatureName } from '../common/voidSettingsTypes.js';
const configOfBG = (color: Color) => {
return { dark: color, light: color, hcDark: color, hcLight: color, }
@ -268,6 +270,7 @@ class EditCodeService extends Disposable implements IEditCodeService {
@INotificationService private readonly _notificationService: INotificationService,
@ICommandService private readonly _commandService: ICommandService,
@IVoidFileService private readonly _voidFileService: IVoidFileService,
@IVoidSettingsService private readonly _settingsService: IVoidSettingsService,
) {
super();
@ -1377,6 +1380,10 @@ class EditCodeService extends Disposable implements IEditCodeService {
let fullTextSoFar = '' // so far (INCLUDING ignored suffix)
let prevIgnoredSuffix = ''
const featureName: FeatureName = opts.from === 'ClickApply' ? 'Apply' : 'Ctrl+K'
const modelSelection = this._settingsService.state.modelSelectionOfFeature[featureName]
const modelSelectionOptions = modelSelection ? this._settingsService.state.optionsOfModelSelection[modelSelection.providerName]?.[modelSelection.modelName] : undefined
const writeover = async () => {
let resMessageDonePromise: () => void = () => { }
@ -1384,9 +1391,10 @@ class EditCodeService extends Disposable implements IEditCodeService {
streamRequestIdRef.current = this._llmMessageService.sendLLMMessage({
messagesType: 'chatMessages',
useProviderFor: opts.from === 'ClickApply' ? 'Apply' : 'Ctrl+K',
logging: { loggingName: `Edit (Writeover) - ${from}` },
messages,
modelSelection,
modelSelectionOptions,
onText: (params) => {
const { fullText: fullText_ } = params
const newText_ = fullText_.substring(fullTextSoFar.length, Infinity)
@ -1559,6 +1567,12 @@ class EditCodeService extends Disposable implements IEditCodeService {
let oldBlocks: ExtractedSearchReplaceBlock[] = []
const featureName: FeatureName = 'Apply'
const modelSelection = this._settingsService.state.modelSelectionOfFeature[featureName]
const modelSelectionOptions = modelSelection ? this._settingsService.state.optionsOfModelSelection[modelSelection.providerName]?.[modelSelection.modelName] : undefined
const retryLoop = async () => {
// this generates >>>>>>> ORIGINAL <<<<<<< REPLACE blocks and and simultaneously applies it
let shouldSendAnotherMessage = true
@ -1573,9 +1587,10 @@ class EditCodeService extends Disposable implements IEditCodeService {
streamRequestIdRef.current = this._llmMessageService.sendLLMMessage({
messagesType: 'chatMessages',
useProviderFor: 'Apply',
logging: { loggingName: `Edit (Search/Replace) - ${from}` },
messages,
modelSelection,
modelSelectionOptions,
onText: (params) => {
const { fullText } = params
// blocks are [done done done ... {writingFinal|writingOriginal}]

View file

@ -154,7 +154,7 @@ const getChatBubbleId = (threadId: string, messageIdx: number) => `${threadId}-$
// const voidSettingsService = accessor.get('IVoidSettingsService')
// const voidSettingsState = useSettingsState()
// const modelSelection = voidSettingsState.modelSelectionOfFeature['Ctrl+L']
// const modelSelection = voidSettingsState.modelSelectionOfFeature['Chat']
// if (!modelSelection) return null
// const { modelName, providerName } = modelSelection
@ -210,13 +210,13 @@ const ReasoningOptionDropdown = () => {
const voidSettingsService = accessor.get('IVoidSettingsService')
const voidSettingsState = useSettingsState()
const modelSelection = voidSettingsState.modelSelectionOfFeature['Ctrl+L']
const modelSelection = voidSettingsState.modelSelectionOfFeature['Chat']
if (!modelSelection) return null
const { modelName, providerName } = modelSelection
const { canToggleReasoning, reasoningBudgetSlider } = getModelCapabilities(providerName, modelName).supportsReasoning || {}
const { isReasoningEnabled } = getModelSelectionState(providerName, modelName, voidSettingsState.optionsOfModelSelection)
const { isReasoningEnabled } = getModelSelectionState(providerName, modelName, voidSettingsState.optionsOfModelSelection[providerName]?.[modelName])
if (canToggleReasoning && !reasoningBudgetSlider) { // if it's just a on/off toggle without a power slider (no models right now)
return null // unused right now
@ -277,7 +277,6 @@ interface VoidChatAreaProps {
divRef?: React.RefObject<HTMLDivElement>;
// UI customization
featureName: FeatureName;
className?: string;
showModelDropdown?: boolean;
showSelections?: boolean;
@ -304,7 +303,6 @@ export const VoidChatArea: React.FC<VoidChatAreaProps> = ({
isDisabled = false,
className = '',
showModelDropdown = true,
featureName,
showSelections = false,
showProspectiveSelections = true,
selections,
@ -363,7 +361,7 @@ export const VoidChatArea: React.FC<VoidChatAreaProps> = ({
{showModelDropdown && (
<div className='max-w-[200px] flex-grow'>
<ReasoningOptionDropdown />
<ModelDropdown featureName={featureName} />
<ModelDropdown featureName={'Chat'} />
</div>
)}
@ -841,7 +839,6 @@ const UserMessageComponent = ({ chatMessage, messageIdx, isLoading }: ChatBubble
isDisabled={isDisabled}
showSelections={true}
showProspectiveSelections={false}
featureName="Ctrl+L"
selections={stagingSelections}
setSelections={setStagingSelections}
>
@ -1314,22 +1311,17 @@ const ChatBubble = ({ chatMessage, isLoading, messageIdx }: ChatBubbleProps) =>
else if (role === 'tool_request') {
const isLastMessage = true // TODO!!! fix this
if (!isLastMessage) return null
const ToolMessageComponent = toolNameToComponent[chatMessage.name].requestWrapper as React.FC<{ toolRequest: any }> // ts isnt smart enough...
const ToolRequestComponent = toolNameToComponent[chatMessage.name].requestWrapper as React.FC<{ toolRequest: any }> // ts isnt smart enough...
return <>
<ToolMessageComponent
toolRequest={chatMessage}
/>
<ToolRequestComponent toolRequest={chatMessage} />
<ToolRequestAcceptRejectButtons toolRequest={chatMessage} />
</>
}
else if (role === 'tool') {
const title = toolNameToTitle[chatMessage.name]
if (chatMessage.result.type === 'error') return <ToolError title={title} errorMessage={chatMessage.result.value} />
const ToolMessageComponent = toolNameToComponent[chatMessage.name].resultWrapper as React.FC<{ toolMessage: any }> // ts isnt smart enough...
return <ToolMessageComponent
toolMessage={chatMessage}
/>
const ToolResultComponent = toolNameToComponent[chatMessage.name].resultWrapper as React.FC<{ toolMessage: any }> // ts isnt smart enough...
return <ToolResultComponent toolMessage={chatMessage} />
}
@ -1383,7 +1375,7 @@ export const SidebarChat = () => {
const initVal = ''
const [instructionsAreEmpty, setInstructionsAreEmpty] = useState(!initVal)
const isDisabled = instructionsAreEmpty || !!isFeatureNameDisabled('Ctrl+L', settingsState)
const isDisabled = instructionsAreEmpty || !!isFeatureNameDisabled('Chat', settingsState)
const [sidebarRef, sidebarDimensions] = useResizeObserver()
const [chatAreaRef, chatAreaDimensions] = useResizeObserver()
@ -1513,7 +1505,6 @@ export const SidebarChat = () => {
selections={selections}
setSelections={setSelections}
onClickAnywhere={() => { textAreaRef.current?.focus() }}
featureName="Ctrl+L"
>
<VoidInputBox2
className='min-h-[81px] px-0.5'

View file

@ -13,7 +13,6 @@ import { generateUuid } from '../../../../base/common/uuid.js';
import { Event } from '../../../../base/common/event.js';
import { Disposable } from '../../../../base/common/lifecycle.js';
import { IVoidSettingsService } from './voidSettingsService.js';
import { displayInfoOfProviderName, isFeatureNameDisabled } from './voidSettingsTypes.js';
// import { INotificationService } from '../../notification/common/notification.js';
// calls channel to implement features
@ -83,32 +82,15 @@ export class LLMMessageService extends Disposable implements ILLMMessageService
}
sendLLMMessage(params: ServiceSendLLMMessageParams) {
const { onText, onFinalMessage, onError, ...proxyParams } = params;
const { useProviderFor: featureName } = proxyParams
const { onText, onFinalMessage, onError, modelSelection, ...proxyParams } = params;
// throw an error if no model/provider selected (this should usually never be reached, the UI should check this first, but might happen in cases like Apply where we haven't built much UI/checks yet, good practice to have check logic on backend)
const isDisabled = isFeatureNameDisabled(featureName, this.voidSettingsService.state)
const modelSelection = this.voidSettingsService.state.modelSelectionOfFeature[featureName]
if (isDisabled || modelSelection === null) {
let message: string
if (isDisabled === 'addProvider' || isDisabled === 'providerNotAutoDetected')
message = `Please add a provider in Void's Settings.`
else if (isDisabled === 'addModel')
message = `Please add a model.`
else if (isDisabled === 'needToEnableModel')
message = `Please enable a model.`
else if (isDisabled === 'notFilledIn')
message = `Please fill in Void's Settings${modelSelection !== null ? ` for ${displayInfoOfProviderName(modelSelection.providerName).title}` : ''}.`
else
message = `Please add a provider in Void's Settings.`
if (modelSelection === null) {
const message = `Please add a provider in Void's Settings.`
onError({ message, fullError: null })
return null
}
const { providerName, modelName } = modelSelection
// add state for request id
const requestId = generateUuid();
this.llmMessageHooks.onText[requestId] = onText
@ -116,17 +98,15 @@ export class LLMMessageService extends Disposable implements ILLMMessageService
this.llmMessageHooks.onError[requestId] = onError
const { aiInstructions } = this.voidSettingsService.state.globalSettings
const { settingsOfProvider, optionsOfModelSelection, } = this.voidSettingsService.state
const { settingsOfProvider, } = this.voidSettingsService.state
// params will be stripped of all its functions over the IPC channel
this.channel.call('sendLLMMessage', {
...proxyParams,
aiInstructions,
requestId,
providerName,
modelName,
settingsOfProvider,
optionsOfModelSelection,
modelSelection,
} satisfies MainSendLLMMessageParams);
return requestId

View file

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------*/
import type { InternalToolInfo, ToolName } from '../browser/toolsService.js'
import { FeatureName, OptionsOfModelSelection, ProviderName, SettingsOfProvider } from './voidSettingsTypes.js'
import { ModelSelection, ModelSelectionOptions, ProviderName, SettingsOfProvider } from './voidSettingsTypes.js'
export const errorDetails = (fullError: Error | null): string | null => {
@ -82,7 +82,8 @@ export type ServiceSendLLMMessageParams = {
onFinalMessage: OnFinalMessage;
onError: OnError;
logging: { loggingName: string, };
useProviderFor: FeatureName;
modelSelection: ModelSelection | null;
modelSelectionOptions: ModelSelectionOptions | undefined;
} & SendLLMType;
// params to the true sendLLMMessage function
@ -95,10 +96,10 @@ export type SendLLMMessageParams = {
aiInstructions: string;
providerName: ProviderName;
modelName: string;
modelSelection: ModelSelection;
modelSelectionOptions: ModelSelectionOptions | undefined;
settingsOfProvider: SettingsOfProvider;
optionsOfModelSelection: OptionsOfModelSelection;
} & SendLLMType

View file

@ -3,7 +3,7 @@
* Licensed under the Apache License, Version 2.0. See LICENSE.txt for more information.
*--------------------------------------------------------------------------------------*/
import { OptionsOfModelSelection, ProviderName } from './voidSettingsTypes.js';
import { ModelSelectionOptions, ProviderName } from './voidSettingsTypes.js';
export const defaultModelsOfProvider = {
@ -633,11 +633,11 @@ export const getProviderCapabilities = (providerName: ProviderName) => {
}
// state from optionsOfModelSelection
export const getModelSelectionState = (providerName: ProviderName, modelName: string, optionsOfModelSelection: OptionsOfModelSelection): { isReasoningEnabled: boolean, reasoningBudget: number | undefined } => {
const { canToggleReasoning } = getModelCapabilities(providerName, modelName).supportsReasoning || {}
export const getModelSelectionState = (providerName: ProviderName, modelName: string, modelSelectionOptions: ModelSelectionOptions | undefined): { isReasoningEnabled: boolean, reasoningBudget: number | undefined } => {
const { canToggleReasoning, reasoningBudgetSlider } = getModelCapabilities(providerName, modelName).supportsReasoning || {}
const defaultEnabledVal = canToggleReasoning ? true : false
const isReasoningEnabled = optionsOfModelSelection[providerName]?.[modelName]?.reasoningEnabled ?? defaultEnabledVal
const reasoningBudget = optionsOfModelSelection[providerName]?.[modelName]?.reasoningBudget
const isReasoningEnabled = modelSelectionOptions?.reasoningEnabled ?? defaultEnabledVal
const reasoningBudget = reasoningBudgetSlider?.type === 'slider' ? modelSelectionOptions?.reasoningBudget ?? reasoningBudgetSlider?.default : undefined
return { isReasoningEnabled, reasoningBudget }
}

View file

@ -14,8 +14,10 @@ import { IMetricsService } from './metricsService.js';
import { getModelCapabilities } from './modelCapabilities.js';
import { defaultSettingsOfProvider, FeatureName, ProviderName, ModelSelectionOfFeature, SettingsOfProvider, SettingName, providerNames, ModelSelection, modelSelectionsEqual, featureNames, VoidModelInfo, GlobalSettings, GlobalSettingName, defaultGlobalSettings, defaultProviderSettings, ModelSelectionOptions, OptionsOfModelSelection } from './voidSettingsTypes.js';
// past values:
// 'void.settingsServiceStorage'
const STORAGE_KEY = 'void.settingsServiceStorage'
const STORAGE_KEY = 'void.settingsServiceStorageI'
// name is the name in the dropdown
@ -97,7 +99,7 @@ const _updatedModelsAfterDefaultModelsChange = (defaultModelNames: string[], opt
export const modelFilterOfFeatureName: { [featureName in FeatureName]: { filter: (o: ModelSelection) => boolean; emptyMessage: string | null } } = {
'Autocomplete': { filter: o => getModelCapabilities(o.providerName, o.modelName).supportsFIM, emptyMessage: 'No models support FIM' },
'Ctrl+L': { filter: o => true, emptyMessage: null },
'Chat': { filter: o => true, emptyMessage: null },
'Ctrl+K': { filter: o => true, emptyMessage: null },
'Apply': { filter: o => true, emptyMessage: null },
}
@ -172,7 +174,7 @@ const _validatedState = (state: Omit<VoidSettingsState, '_modelOptions'>) => {
const defaultState = () => {
const d: VoidSettingsState = {
settingsOfProvider: deepClone(defaultSettingsOfProvider),
modelSelectionOfFeature: { 'Ctrl+L': null, 'Ctrl+K': null, 'Autocomplete': null, 'Apply': null },
modelSelectionOfFeature: { 'Chat': null, 'Ctrl+K': null, 'Autocomplete': null, 'Apply': null },
globalSettings: deepClone(defaultGlobalSettings),
optionsOfModelSelection: {},
_modelOptions: [], // computed later

View file

@ -310,7 +310,7 @@ export const modelSelectionsEqual = (m1: ModelSelection, m2: ModelSelection) =>
}
// this is a state
export const featureNames = ['Ctrl+L', 'Ctrl+K', 'Autocomplete', 'Apply'] as const
export const featureNames = ['Chat', 'Ctrl+K', 'Autocomplete', 'Apply'] as const
export type ModelSelectionOfFeature = Record<(typeof featureNames)[number], ModelSelection | null>
export type FeatureName = keyof ModelSelectionOfFeature
@ -321,7 +321,7 @@ export const displayInfoOfFeatureName = (featureName: FeatureName) => {
else if (featureName === 'Ctrl+K')
return 'Quick Edit'
// sidebar:
else if (featureName === 'Ctrl+L')
else if (featureName === 'Chat')
return 'Chat'
else if (featureName === 'Apply')
return 'Fast Apply'

View file

@ -11,7 +11,7 @@ import { Model as OpenAIModel } from 'openai/resources/models.js';
import { extractReasoningOnFinalMessage, extractReasoningOnTextWrapper } from '../../browser/helpers/extractCodeFromResult.js';
import { LLMChatMessage, LLMFIMMessage, ModelListParams, OllamaModelResponse, OnError, OnFinalMessage, OnText } from '../../common/llmMessageTypes.js';
import { InternalToolInfo, isAToolName, ToolName } from '../../browser/toolsService.js';
import { defaultProviderSettings, displayInfoOfProviderName, OptionsOfModelSelection, ProviderName, SettingsOfProvider } from '../../common/voidSettingsTypes.js';
import { defaultProviderSettings, displayInfoOfProviderName, ModelSelectionOptions, ProviderName, SettingsOfProvider } from '../../common/voidSettingsTypes.js';
import { prepareFIMMessage, prepareMessages } from './preprocessLLMMessages.js';
import { getModelSelectionState, getModelCapabilities, getProviderCapabilities } from '../../common/modelCapabilities.js';
@ -23,7 +23,7 @@ type InternalCommonMessageParams = {
onError: OnError;
providerName: ProviderName;
settingsOfProvider: SettingsOfProvider;
optionsOfModelSelection: OptionsOfModelSelection;
modelSelectionOptions: ModelSelectionOptions | undefined;
modelName: string;
_setAborter: (aborter: () => void) => void;
}
@ -288,7 +288,7 @@ const toolCallsFrom_Anthropic = (content: Anthropic.Messages.ContentBlock[]): To
}).filter(t => !!t)
}
const sendAnthropicChat = ({ messages: messages_, providerName, onText, onFinalMessage, onError, settingsOfProvider, optionsOfModelSelection, modelName: modelName_, _setAborter, aiInstructions, tools: tools_ }: SendChatParams_Internal) => {
const sendAnthropicChat = ({ messages: messages_, providerName, onText, onFinalMessage, onError, settingsOfProvider, modelSelectionOptions, modelName: modelName_, _setAborter, aiInstructions, tools: tools_ }: SendChatParams_Internal) => {
const {
modelName,
supportsSystemMessage,
@ -299,7 +299,7 @@ const sendAnthropicChat = ({ messages: messages_, providerName, onText, onFinalM
const {
isReasoningEnabled,
reasoningBudget,
} = getModelSelectionState(providerName, modelName_, optionsOfModelSelection) // user's modelName_ here
} = getModelSelectionState(providerName, modelName_, modelSelectionOptions) // user's modelName_ here
const { messages, separateSystemMessageStr } = prepareMessages({ messages: messages_, aiInstructions, supportsSystemMessage, supportsTools, supportsAnthropicReasoningSignature: true })

View file

@ -19,9 +19,8 @@ export const sendLLMMessage = ({
abortRef: abortRef_,
logging: { loggingName },
settingsOfProvider,
optionsOfModelSelection,
providerName,
modelName,
modelSelection,
modelSelectionOptions,
tools,
}: SendLLMMessageParams,
@ -29,6 +28,8 @@ export const sendLLMMessage = ({
) => {
const { providerName, modelName } = modelSelection
// only captures number of messages and message "shape", no actual code, instructions, prompts, etc
const captureLLMEvent = (eventId: string, extras?: object) => {
metricsService.capture(eventId, {
@ -105,12 +106,12 @@ export const sendLLMMessage = ({
}
const { sendFIM, sendChat } = implementation
if (messagesType === 'chatMessages') {
sendChat({ messages: messages_, onText, onFinalMessage, onError, settingsOfProvider, optionsOfModelSelection, modelName, _setAborter, providerName, aiInstructions, tools })
sendChat({ messages: messages_, onText, onFinalMessage, onError, settingsOfProvider, modelSelectionOptions, modelName, _setAborter, providerName, aiInstructions, tools })
return
}
if (messagesType === 'FIMMessage') {
if (sendFIM) {
sendFIM({ messages: messages_, onText, onFinalMessage, onError, settingsOfProvider, optionsOfModelSelection, modelName, _setAborter, providerName, aiInstructions })
sendFIM({ messages: messages_, onText, onFinalMessage, onError, settingsOfProvider, modelSelectionOptions, modelName, _setAborter, providerName, aiInstructions })
return
}
onError({ message: `Error: This provider does not support Autocomplete yet.`, fullError: null })