mirror of
https://github.com/voideditor/void
synced 2026-05-24 01:48:25 +00:00
get ready to sync ollama models
This commit is contained in:
parent
d809839530
commit
6703aa1545
10 changed files with 168 additions and 224 deletions
|
|
@ -3,7 +3,7 @@
|
|||
* Void Editor additions licensed under the AGPL 3.0 License.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IChannel } from '../../../base/parts/ipc/common/ipc.js';
|
||||
import { ProxyChannel } from '../../../base/parts/ipc/common/ipc.js';
|
||||
import { IMainProcessService } from '../../ipc/common/mainProcessService.js';
|
||||
import { InstantiationType, registerSingleton } from '../../instantiation/common/extensions.js';
|
||||
import { IMetricsService } from '../common/metricsService.js';
|
||||
|
|
@ -13,17 +13,17 @@ import { IMetricsService } from '../common/metricsService.js';
|
|||
export class MetricsService implements IMetricsService {
|
||||
|
||||
readonly _serviceBrand: undefined;
|
||||
private readonly channel: IChannel;
|
||||
private readonly metricsService: IMetricsService;
|
||||
|
||||
constructor(
|
||||
@IMainProcessService mainProcessService: IMainProcessService // (only usable on client side)
|
||||
) {
|
||||
this.channel = mainProcessService.getChannel('void-channel-metrics')
|
||||
this.metricsService = ProxyChannel.toService<IMetricsService>(mainProcessService.getChannel('void-channel-metrics'));
|
||||
}
|
||||
|
||||
// call capture on the channel
|
||||
capture(...params: Parameters<IMetricsService['capture']>) {
|
||||
this.channel.call('capture', params);
|
||||
this.metricsService.capture(...params);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
9
src/vs/platform/void/browser/void.contribution.ts
Normal file
9
src/vs/platform/void/browser/void.contribution.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
// metrics
|
||||
import '../browser/metricsService.js'
|
||||
|
||||
// llmMessage
|
||||
import '../browser/llmMessageService.js'
|
||||
|
||||
// voidConfig
|
||||
import '../common/voidConfigService.js'
|
||||
58
src/vs/platform/void/common/voidConfigModelDefaults.ts
Normal file
58
src/vs/platform/void/common/voidConfigModelDefaults.ts
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
|
||||
|
||||
export const defaultAnthropicModels = [
|
||||
'claude-3-5-sonnet-20240620',
|
||||
// 'claude-3-opus-20240229',
|
||||
// 'claude-3-sonnet-20240229',
|
||||
// 'claude-3-haiku-20240307'
|
||||
]
|
||||
|
||||
|
||||
export const defaultOpenAIModels = [
|
||||
'o1-preview',
|
||||
'o1-mini',
|
||||
'gpt-4o',
|
||||
'gpt-4o-mini',
|
||||
// 'gpt-4o-2024-05-13',
|
||||
// 'gpt-4o-2024-08-06',
|
||||
// 'gpt-4o-mini-2024-07-18',
|
||||
// 'gpt-4-turbo',
|
||||
// 'gpt-4-turbo-2024-04-09',
|
||||
// 'gpt-4-turbo-preview',
|
||||
// 'gpt-4-0125-preview',
|
||||
// 'gpt-4-1106-preview',
|
||||
// 'gpt-4',
|
||||
// 'gpt-4-0613',
|
||||
// 'gpt-3.5-turbo-0125',
|
||||
// 'gpt-3.5-turbo',
|
||||
// 'gpt-3.5-turbo-1106',
|
||||
]
|
||||
|
||||
|
||||
|
||||
export const defaultGroqModels = [
|
||||
"mixtral-8x7b-32768",
|
||||
"llama2-70b-4096",
|
||||
"gemma-7b-it"
|
||||
]
|
||||
|
||||
|
||||
export const defaultGeminiModels = [
|
||||
'gemini-1.5-flash',
|
||||
'gemini-1.5-pro',
|
||||
'gemini-1.5-flash-8b',
|
||||
'gemini-1.0-pro'
|
||||
]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export const dummyModelData = {
|
||||
anthropic: ['claude 3.5'],
|
||||
openAI: ['gpt 4o'],
|
||||
ollama: ['llama 3.2', 'codestral'],
|
||||
openRouter: ['qwen 2.5'],
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -4,18 +4,7 @@
|
|||
* Void Editor additions licensed under the AGPL 3.0 License.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
// const voidProviderDefaults = {
|
||||
// "ctrl+L":{
|
||||
// models:[ // select only if present
|
||||
// {
|
||||
// provider:"anthropic",
|
||||
// model:"claude-3-5-sonnet-20240620"
|
||||
// },
|
||||
// ]
|
||||
// },
|
||||
// }
|
||||
import { defaultAnthropicModels, defaultGeminiModels, defaultGroqModels, defaultOpenAIModels } from './voidConfigModelDefaults.js'
|
||||
|
||||
|
||||
|
||||
|
|
@ -45,173 +34,29 @@ export const voidProviderDefaults = {
|
|||
} as const
|
||||
|
||||
|
||||
export const dummyModelData = {
|
||||
anthropic: ['claude 3.5'],
|
||||
openAI: ['gpt 4o'],
|
||||
ollama: ['llama 3.2'],
|
||||
openRouter: ['qwen 2.5'],
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export const voidInitModelOptions = {
|
||||
anthropic: () => ({
|
||||
// model: 'claude-3-5-sonnet-20240620',
|
||||
models: [
|
||||
'claude-3-5-sonnet-20240620',
|
||||
'claude-3-opus-20240229',
|
||||
'claude-3-sonnet-20240229',
|
||||
'claude-3-haiku-20240307'
|
||||
],
|
||||
}),
|
||||
openAI: () => ({
|
||||
// model: 'gpt-4o',
|
||||
models: [
|
||||
'o1-preview',
|
||||
'o1-mini',
|
||||
'gpt-4o',
|
||||
'gpt-4o-2024-05-13',
|
||||
'gpt-4o-2024-08-06',
|
||||
'gpt-4o-mini',
|
||||
'gpt-4o-mini-2024-07-18',
|
||||
'gpt-4-turbo',
|
||||
'gpt-4-turbo-2024-04-09',
|
||||
'gpt-4-turbo-preview',
|
||||
'gpt-4-0125-preview',
|
||||
'gpt-4-1106-preview',
|
||||
'gpt-4',
|
||||
'gpt-4-0613',
|
||||
'gpt-3.5-turbo-0125',
|
||||
'gpt-3.5-turbo',
|
||||
'gpt-3.5-turbo-1106',
|
||||
],
|
||||
}),
|
||||
ollama: () => ({ // TODO make this do a fetch to get the models
|
||||
// model: 'codestral',
|
||||
models: [
|
||||
'codestral',
|
||||
'qwen2.5-coder',
|
||||
'qwen2.5-coder:0.5b',
|
||||
'qwen2.5-coder:1.5b',
|
||||
'qwen2.5-coder:3b',
|
||||
'qwen2.5-coder:7b',
|
||||
'qwen2.5-coder:14b',
|
||||
'qwen2.5-coder:32b',
|
||||
'codegemma',
|
||||
'codegemma:2b',
|
||||
'codegemma:7b',
|
||||
'codellama',
|
||||
'codellama:7b',
|
||||
'codellama:13b',
|
||||
'codellama:34b',
|
||||
'codellama:70b',
|
||||
'codellama:code',
|
||||
'codellama:python',
|
||||
'command-r',
|
||||
'command-r:35b',
|
||||
'command-r-plus',
|
||||
'command-r-plus:104b',
|
||||
'deepseek-coder-v2',
|
||||
'deepseek-coder-v2:16b',
|
||||
'deepseek-coder-v2:236b',
|
||||
'falcon2',
|
||||
'falcon2:11b',
|
||||
'firefunction-v2',
|
||||
'firefunction-v2:70b',
|
||||
'gemma',
|
||||
'gemma:2b',
|
||||
'gemma:7b',
|
||||
'gemma2',
|
||||
'gemma2:2b',
|
||||
'gemma2:9b',
|
||||
'gemma2:27b',
|
||||
'llama2',
|
||||
'llama2:7b',
|
||||
'llama2:13b',
|
||||
'llama2:70b',
|
||||
'llama3',
|
||||
'llama3:8b',
|
||||
'llama3:70b',
|
||||
'llama3-chatqa',
|
||||
'llama3-chatqa:8b',
|
||||
'llama3-chatqa:70b',
|
||||
'llama3-gradient',
|
||||
'llama3-gradient:8b',
|
||||
'llama3-gradient:70b',
|
||||
'llama3.1',
|
||||
'llama3.1:8b',
|
||||
'llama3.1:70b',
|
||||
'llama3.1:405b',
|
||||
'llava',
|
||||
'llava:7b',
|
||||
'llava:13b',
|
||||
'llava:34b',
|
||||
'llava-llama3',
|
||||
'llava-llama3:8b',
|
||||
'llava-phi3',
|
||||
'llava-phi3:3.8b',
|
||||
'mistral',
|
||||
'mistral:7b',
|
||||
'mistral-large',
|
||||
'mistral-large:123b',
|
||||
'mistral-nemo',
|
||||
'mistral-nemo:12b',
|
||||
'mixtral',
|
||||
'mixtral:8x7b',
|
||||
'mixtral:8x22b',
|
||||
'moondream',
|
||||
'moondream:1.8b',
|
||||
'openhermes',
|
||||
'openhermes:v2.5',
|
||||
'phi3',
|
||||
'phi3:3.8b',
|
||||
'phi3:14b',
|
||||
'phi3.5',
|
||||
'phi3.5:3.8b',
|
||||
'qwen',
|
||||
'qwen:7b',
|
||||
'qwen:14b',
|
||||
'qwen:32b',
|
||||
'qwen:72b',
|
||||
'qwen:110b',
|
||||
'qwen2',
|
||||
'qwen2:0.5b',
|
||||
'qwen2:1.5b',
|
||||
'qwen2:7b',
|
||||
'qwen2:72b',
|
||||
'smollm',
|
||||
'smollm:135m',
|
||||
'smollm:360m',
|
||||
'smollm:1.7b',
|
||||
],
|
||||
}),
|
||||
openRouter: () => ({
|
||||
// model: 'openai/gpt-4o',
|
||||
models: null, // any
|
||||
}),
|
||||
openAICompatible: () => ({
|
||||
// model: 'openai/gpt-4o',
|
||||
models: null, // any
|
||||
}),
|
||||
gemini: () => ({
|
||||
// model: 'gemini-1.5-flash',
|
||||
models: [
|
||||
'gemini-1.5-flash',
|
||||
'gemini-1.5-pro',
|
||||
'gemini-1.5-flash-8b',
|
||||
'gemini-1.0-pro'
|
||||
],
|
||||
}),
|
||||
groq: () => ({
|
||||
// model: 'mixtral-8x7b-32768',
|
||||
models: [
|
||||
"mixtral-8x7b-32768",
|
||||
"llama2-70b-4096",
|
||||
"gemma-7b-it"
|
||||
]
|
||||
})
|
||||
} as const
|
||||
anthropic: {
|
||||
models: defaultAnthropicModels,
|
||||
},
|
||||
openAI: {
|
||||
models: defaultOpenAIModels,
|
||||
},
|
||||
ollama: {
|
||||
models: [],//getDefaultOllamaModels,
|
||||
},
|
||||
openRouter: {
|
||||
models: [], // any string
|
||||
},
|
||||
openAICompatible: {
|
||||
models: [],
|
||||
},
|
||||
gemini: {
|
||||
models: defaultGeminiModels,
|
||||
},
|
||||
groq: {
|
||||
models: defaultGroqModels,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -231,7 +76,7 @@ export type SettingsOfProvider = {
|
|||
enabled: string, // 'true' | 'false'
|
||||
maxTokens: string,
|
||||
|
||||
models: string[] | null, // if null, user can type in any string as a model
|
||||
models: string[], // if null, user can type in any string as a model
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -323,43 +168,43 @@ export const displayInfoOfSettingName = (providerName: ProviderName, settingName
|
|||
export const defaultVoidProviderState: SettingsOfProvider = {
|
||||
anthropic: {
|
||||
...voidProviderDefaults.anthropic,
|
||||
...voidInitModelOptions.anthropic(),
|
||||
...voidInitModelOptions.anthropic,
|
||||
enabled: 'false',
|
||||
maxTokens: '',
|
||||
},
|
||||
openAI: {
|
||||
...voidProviderDefaults.openAI,
|
||||
...voidInitModelOptions.openAI(),
|
||||
...voidInitModelOptions.openAI,
|
||||
enabled: 'false',
|
||||
maxTokens: '',
|
||||
},
|
||||
ollama: {
|
||||
...voidProviderDefaults.ollama,
|
||||
...voidInitModelOptions.ollama(),
|
||||
...voidInitModelOptions.ollama,
|
||||
enabled: 'false',
|
||||
maxTokens: '',
|
||||
},
|
||||
openRouter: {
|
||||
...voidProviderDefaults.openRouter,
|
||||
...voidInitModelOptions.openRouter(),
|
||||
...voidInitModelOptions.openRouter,
|
||||
enabled: 'false',
|
||||
maxTokens: '',
|
||||
},
|
||||
openAICompatible: {
|
||||
...voidProviderDefaults.openAICompatible,
|
||||
...voidInitModelOptions.openAICompatible(),
|
||||
...voidInitModelOptions.openAICompatible,
|
||||
enabled: 'false',
|
||||
maxTokens: '',
|
||||
},
|
||||
gemini: {
|
||||
...voidProviderDefaults.gemini,
|
||||
...voidInitModelOptions.gemini(),
|
||||
...voidInitModelOptions.gemini,
|
||||
enabled: 'false',
|
||||
maxTokens: '',
|
||||
},
|
||||
groq: {
|
||||
...voidProviderDefaults.groq,
|
||||
...voidInitModelOptions.groq(),
|
||||
...voidInitModelOptions.groq,
|
||||
enabled: 'false',
|
||||
maxTokens: '',
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,32 @@
|
|||
* Void Editor additions licensed under the AGPL 3.0 License.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Ollama } from 'ollama';
|
||||
import { ModelResponse, Ollama } from 'ollama';
|
||||
import { SendLLMMessageFnTypeInternal } from '../../common/llmMessageTypes.js';
|
||||
import { parseMaxTokensStr } from './util.js';
|
||||
import { SettingsOfProvider } from '../../common/voidConfigTypes.js';
|
||||
|
||||
|
||||
type GetOllamaModelsFnType = (args: {
|
||||
settingsOfProvider: SettingsOfProvider;
|
||||
onSuccess: (param: { models: ModelResponse[] }) => void;
|
||||
onError: (param: { error: any }) => void;
|
||||
}) => void
|
||||
|
||||
export const getDefaultOllamaModels: GetOllamaModelsFnType = async ({ onSuccess, onError, settingsOfProvider }) => {
|
||||
const thisConfig = settingsOfProvider.ollama
|
||||
const ollama = new Ollama({ host: thisConfig.endpoint })
|
||||
ollama.list()
|
||||
.then((response) => {
|
||||
const { models } = response
|
||||
onSuccess({ models })
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('getDefaultOllamaModels: error:', error)
|
||||
onError(error)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// Ollama
|
||||
export const sendOllamaMsg: SendLLMMessageFnTypeInternal = ({ messages, onText, onFinalMessage, onError, settingsOfProvider, modelName, _setAborter }) => {
|
||||
|
|
@ -50,3 +73,4 @@ export const sendOllamaMsg: SendLLMMessageFnTypeInternal = ({ messages, onText,
|
|||
|
||||
|
||||
|
||||
// ['codestral', 'qwen2.5-coder', 'qwen2.5-coder:0.5b', 'qwen2.5-coder:1.5b', 'qwen2.5-coder:3b', 'qwen2.5-coder:7b', 'qwen2.5-coder:14b', 'qwen2.5-coder:32b', 'codegemma', 'codegemma:2b', 'codegemma:7b', 'codellama', 'codellama:7b', 'codellama:13b', 'codellama:34b', 'codellama:70b', 'codellama:code', 'codellama:python', 'command-r', 'command-r:35b', 'command-r-plus', 'command-r-plus:104b', 'deepseek-coder-v2', 'deepseek-coder-v2:16b', 'deepseek-coder-v2:236b', 'falcon2', 'falcon2:11b', 'firefunction-v2', 'firefunction-v2:70b', 'gemma', 'gemma:2b', 'gemma:7b', 'gemma2', 'gemma2:2b', 'gemma2:9b', 'gemma2:27b', 'llama2', 'llama2:7b', 'llama2:13b', 'llama2:70b', 'llama3', 'llama3:8b', 'llama3:70b', 'llama3-chatqa', 'llama3-chatqa:8b', 'llama3-chatqa:70b', 'llama3-gradient', 'llama3-gradient:8b', 'llama3-gradient:70b', 'llama3.1', 'llama3.1:8b', 'llama3.1:70b', 'llama3.1:405b', 'llava', 'llava:7b', 'llava:13b', 'llava:34b', 'llava-llama3', 'llava-llama3:8b', 'llava-phi3', 'llava-phi3:3.8b', 'mistral', 'mistral:7b', 'mistral-large', 'mistral-large:123b', 'mistral-nemo', 'mistral-nemo:12b', 'mixtral', 'mixtral:8x7b', 'mixtral:8x22b', 'moondream', 'moondream:1.8b', 'openhermes', 'openhermes:v2.5', 'phi3', 'phi3:3.8b', 'phi3:14b', 'phi3.5', 'phi3.5:3.8b', 'qwen', 'qwen:7b', 'qwen:14b', 'qwen:32b', 'qwen:72b', 'qwen:110b', 'qwen2', 'qwen2:0.5b', 'qwen2:1.5b', 'qwen2:7b', 'qwen2:72b', 'smollm', 'smollm:135m', 'smollm:360m', 'smollm:1.7b',]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Glass Devtools, Inc. All rights reserved.
|
||||
* Void Editor additions licensed under the AGPL 3.0 License.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
|
@ -4,7 +4,8 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { useCallback, useEffect, useRef } from 'react'
|
||||
import { dummyModelData, FeatureName, featureNames, ProviderName, providerNames } from '../../../../../../../platform/void/common/voidConfigTypes.js'
|
||||
import { FeatureName, featureNames, ProviderName, providerNames } from '../../../../../../../platform/void/common/voidConfigTypes.js'
|
||||
import { dummyModelData } from '../../../../../../../platform/void/common/voidConfigModelDefaults.js'
|
||||
import { useConfigState, useService } from '../util/services.js'
|
||||
import { VoidSelectBox } from './inputs.js'
|
||||
import { SelectBox } from '../../../../../../../base/browser/ui/selectBox/selectBox.js'
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import { ICodeEditorService } from '../../../../editor/browser/services/codeEdit
|
|||
import { IRange } from '../../../../editor/common/core/range.js';
|
||||
import { ITextModel } from '../../../../editor/common/model.js';
|
||||
import { IVoidSidebarStateService, VOID_VIEW_ID } from './registerSidebar.js';
|
||||
import { IMetricsService } from '../../../../platform/void/common/metricsService.js';
|
||||
// import { IClipboardService } from '../../../../platform/clipboard/common/clipboardService.js';
|
||||
|
||||
|
||||
|
|
@ -60,8 +61,11 @@ registerAction2(class extends Action2 {
|
|||
if (!model)
|
||||
return
|
||||
|
||||
|
||||
const stateService = accessor.get(IVoidSidebarStateService)
|
||||
const metricsService = accessor.get(IMetricsService)
|
||||
|
||||
metricsService.capture('Chat Navigation', { type: 'Ctrl+L' })
|
||||
|
||||
stateService.setState({ isHistoryOpen: false, currentTab: 'chat' })
|
||||
stateService.fireFocusChat()
|
||||
|
||||
|
|
@ -109,9 +113,12 @@ registerAction2(class extends Action2 {
|
|||
}
|
||||
async run(accessor: ServicesAccessor): Promise<void> {
|
||||
const stateService = accessor.get(IVoidSidebarStateService)
|
||||
const metricsService = accessor.get(IMetricsService)
|
||||
|
||||
metricsService.capture('Chat Navigation', { type: 'New Chat' })
|
||||
|
||||
stateService.setState({ isHistoryOpen: false, currentTab: 'chat' })
|
||||
stateService.fireFocusChat()
|
||||
|
||||
const historyService = accessor.get(IThreadHistoryService)
|
||||
historyService.startNewThread()
|
||||
}
|
||||
|
|
@ -129,6 +136,10 @@ registerAction2(class extends Action2 {
|
|||
}
|
||||
async run(accessor: ServicesAccessor): Promise<void> {
|
||||
const stateService = accessor.get(IVoidSidebarStateService)
|
||||
const metricsService = accessor.get(IMetricsService)
|
||||
|
||||
metricsService.capture('Chat Navigation', { type: 'History' })
|
||||
|
||||
stateService.setState({ isHistoryOpen: !stateService.state.isHistoryOpen, currentTab: 'chat' })
|
||||
stateService.fireBlurChat()
|
||||
}
|
||||
|
|
@ -146,6 +157,10 @@ registerAction2(class extends Action2 {
|
|||
}
|
||||
async run(accessor: ServicesAccessor): Promise<void> {
|
||||
const stateService = accessor.get(IVoidSidebarStateService)
|
||||
const metricsService = accessor.get(IMetricsService)
|
||||
|
||||
metricsService.capture('Chat Navigation', { type: 'Settings' })
|
||||
|
||||
stateService.setState({ isHistoryOpen: false, currentTab: stateService.state.currentTab === 'settings' ? 'chat' : 'settings' })
|
||||
stateService.fireBlurChat()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,6 @@ import { IContextKeyService } from '../../../../platform/contextkey/common/conte
|
|||
import { createDecorator, IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
|
||||
import { Disposable } from '../../../../base/common/lifecycle.js';
|
||||
import { Emitter, Event } from '../../../../base/common/event.js';
|
||||
import { InstantiationType, registerSingleton } from '../../../../platform/instantiation/common/extensions.js';
|
||||
import { IViewsService } from '../../../services/views/common/viewsService.js';
|
||||
import { IThreadHistoryService } from './registerThreads.js';
|
||||
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
|
||||
import { IThemeService } from '../../../../platform/theme/common/themeService.js';
|
||||
|
|
@ -37,8 +35,6 @@ import { IKeybindingService } from '../../../../platform/keybinding/common/keybi
|
|||
import { IOpenerService } from '../../../../platform/opener/common/opener.js';
|
||||
import { ITelemetryService } from '../../../../platform/telemetry/common/telemetry.js';
|
||||
import { IHoverService } from '../../../../platform/hover/browser/hover.js';
|
||||
// import { IVoidConfigService } from './registerSettings.js';
|
||||
// import { IEditorService } from '../../../services/editor/common/editorService.js';
|
||||
|
||||
import mountFn from './react/out/sidebar-tsx/Sidebar.js';
|
||||
|
||||
|
|
@ -48,9 +44,8 @@ import { IInlineDiffsService } from './registerInlineDiffs.js';
|
|||
import { IModelService } from '../../../../editor/common/services/model.js';
|
||||
import { ISendLLMMessageService } from '../../../../platform/void/browser/llmMessageService.js';
|
||||
import { IClipboardService } from '../../../../platform/clipboard/common/clipboardService.js';
|
||||
|
||||
|
||||
// import { IClipboardService } from '../../../../platform/clipboard/common/clipboardService.js';
|
||||
import { IViewsService } from '../../../services/views/common/viewsService.js';
|
||||
import { InstantiationType, registerSingleton } from '../../../../platform/instantiation/common/extensions.js';
|
||||
|
||||
|
||||
// compare against search.contribution.ts and debug.contribution.ts, scm.contribution.ts (source control)
|
||||
|
|
@ -136,7 +131,7 @@ const voidViewIcon = registerIcon('void-view-icon', voidThemeIcon, localize('voi
|
|||
|
||||
// called VIEWLET_ID in other places for some reason
|
||||
export const VOID_VIEW_CONTAINER_ID = 'workbench.view.void'
|
||||
export const VOID_VIEW_ID = VOID_VIEW_CONTAINER_ID // not sure if we can change this
|
||||
export const VOID_VIEW_ID = VOID_VIEW_CONTAINER_ID // simplicity
|
||||
|
||||
// Register view container
|
||||
const viewContainerRegistry = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry);
|
||||
|
|
@ -186,14 +181,15 @@ export interface IVoidSidebarStateService {
|
|||
fireFocusChat(): void;
|
||||
fireBlurChat(): void;
|
||||
|
||||
openView(): void;
|
||||
openSidebarView(): void;
|
||||
}
|
||||
|
||||
|
||||
export const IVoidSidebarStateService = createDecorator<IVoidSidebarStateService>('voidSidebarStateService');
|
||||
class VoidSidebarStateService extends Disposable implements IVoidSidebarStateService {
|
||||
_serviceBrand: undefined;
|
||||
|
||||
static readonly ID = 'voidSidebarStateService';
|
||||
|
||||
private readonly _onDidChangeState = new Emitter<void>();
|
||||
readonly onDidChangeState: Event<void> = this._onDidChangeState.event;
|
||||
|
||||
|
|
@ -207,11 +203,20 @@ class VoidSidebarStateService extends Disposable implements IVoidSidebarStateSer
|
|||
// state
|
||||
state: VoidSidebarState
|
||||
|
||||
constructor(
|
||||
@IViewsService private readonly _viewsService: IViewsService,
|
||||
) {
|
||||
super()
|
||||
|
||||
// initial state
|
||||
this.state = { isHistoryOpen: false, currentTab: 'chat', }
|
||||
}
|
||||
|
||||
|
||||
setState(newState: Partial<VoidSidebarState>) {
|
||||
// make sure view is open if the tab changes
|
||||
if ('currentTab' in newState) {
|
||||
this.openView()
|
||||
this.openSidebarView()
|
||||
}
|
||||
|
||||
this.state = { ...this.state, ...newState }
|
||||
|
|
@ -226,27 +231,11 @@ class VoidSidebarStateService extends Disposable implements IVoidSidebarStateSer
|
|||
this._onBlurChat.fire()
|
||||
}
|
||||
|
||||
openView() {
|
||||
openSidebarView() {
|
||||
this._viewsService.openViewContainer(VOID_VIEW_CONTAINER_ID);
|
||||
this._viewsService.openView(VOID_VIEW_ID);
|
||||
}
|
||||
|
||||
constructor(
|
||||
@IViewsService private readonly _viewsService: IViewsService,
|
||||
// @IThreadHistoryService private readonly _threadHistoryService: IThreadHistoryService,
|
||||
) {
|
||||
super()
|
||||
// auto open the view on mount (if it bothers you this is here, this is technically just initializing the state of the view)
|
||||
this.openView()
|
||||
|
||||
// initial state
|
||||
this.state = {
|
||||
isHistoryOpen: false,
|
||||
currentTab: 'chat',
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
registerSingleton(IVoidSidebarStateService, VoidSidebarStateService, InstantiationType.Eager);
|
||||
|
|
|
|||
|
|
@ -17,8 +17,7 @@ import './browser/workbench.contribution.js';
|
|||
//#region --- Void
|
||||
// Void added this:
|
||||
import './contrib/void/browser/void.contribution.js';
|
||||
import '../platform/void/browser/llmMessageService.js';
|
||||
import '../platform/void/common/voidConfigService.js';
|
||||
import '../platform/void/browser/void.contribution.js';
|
||||
//#endregion
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue