separate fastapply model

This commit is contained in:
Andrew Pareles 2025-02-04 20:24:54 -08:00
parent 19ff19fb80
commit 5a9f9f70d9
5 changed files with 8 additions and 6 deletions

View file

@ -3,7 +3,7 @@
* Licensed under the Apache License, Version 2.0. See LICENSE.txt for more information.
*--------------------------------------------------------------------------------------*/
import { ProviderName, SettingsOfProvider } from './voidSettingsTypes.js'
import { FeatureName, ProviderName, SettingsOfProvider } from './voidSettingsTypes.js'
export const errorDetails = (fullError: Error | null): string | null => {
@ -54,7 +54,7 @@ export type ServiceSendLLMMessageParams = {
onFinalMessage: OnFinalMessage;
onError: OnError;
logging: { loggingName: string, };
useProviderFor: 'Ctrl+K' | 'Ctrl+L' | 'Autocomplete';
useProviderFor: FeatureName;
} & SendLLMType
// params to the true sendLLMMessage function

View file

@ -79,7 +79,9 @@ export const sendOpenAIMsg: _InternalSendLLMMessageFnType = ({ messages, onText,
}
else if (providerName === 'openAICompatible') {
const thisConfig = settingsOfProvider.openAICompatible
openai = new OpenAI({ baseURL: thisConfig.endpoint, apiKey: thisConfig.apiKey, dangerouslyAllowBrowser: true })
openai = new OpenAI({
baseURL: thisConfig.endpoint, apiKey: thisConfig.apiKey, dangerouslyAllowBrowser: true
})
options = { model: modelName, messages: messages, stream: true, /*max_completion_tokens: parseMaxTokensStr(thisConfig.maxTokens)*/ }
}
else {

View file

@ -797,6 +797,7 @@ export class AutocompleteService extends Disposable implements IAutocompleteServ
suffix: llmSuffix,
stopTokens: stopTokens,
},
useProviderFor: 'Autocomplete',
logging: { loggingName: 'Autocomplete' },
onText: async ({ fullText, newText }) => {
@ -840,7 +841,6 @@ export class AutocompleteService extends Disposable implements IAutocompleteServ
newAutocompletion.status = 'error'
reject(message)
},
useProviderFor: 'Autocomplete',
})
newAutocompletion.requestId = requestId

View file

@ -204,6 +204,7 @@ class ChatThreadService extends Disposable implements IChatThreadService {
const llmCancelToken = this._llmMessageService.sendLLMMessage({
type: 'sendLLMMessage',
logging: { loggingName: 'Chat' },
useProviderFor: 'Ctrl+L',
messages: [
{ role: 'system', content: chat_systemMessage },
...this.getCurrentThread().messages.map(m => ({ role: m.role, content: m.content || '(null)' })),
@ -217,7 +218,6 @@ class ChatThreadService extends Disposable implements IChatThreadService {
onError: (error) => {
this.finishStreaming(threadId, this.streamState[threadId]?.messageSoFar ?? '', error)
},
useProviderFor: 'Ctrl+L',
})
if (llmCancelToken === null) return

View file

@ -1368,7 +1368,7 @@ class InlineDiffsService extends Disposable implements IInlineDiffsService {
streamRequestIdRef.current = this._llmMessageService.sendLLMMessage({
type: 'sendLLMMessage',
useProviderFor: featureName,
useProviderFor: opts.featureName === 'Ctrl+L' ? 'FastApply' : 'Ctrl+K',
logging: { loggingName: `startApplying - ${featureName}` },
messages,
onText: ({ newText: newText_ }) => {