mirror of
https://github.com/voideditor/void.git
synced 2025-03-15 07:27:58 +00:00
progress
This commit is contained in:
@ -121,6 +121,9 @@ import { normalizeNFC } from '../../base/common/normalization.js';
|
||||
import { ICSSDevelopmentService, CSSDevelopmentService } from '../../platform/cssDev/node/cssDevService.js';
|
||||
import { ExtensionSignatureVerificationService, IExtensionSignatureVerificationService } from '../../platform/extensionManagement/node/extensionSignatureVerificationService.js';
|
||||
|
||||
import { ISendLLMMessageService } from '../../platform/void/common/sendLLMMessage.js';
|
||||
import { SendLLMMessageService } from '../../platform/void/electron-main/sendLLMMessage.js';
|
||||
|
||||
/**
|
||||
* The main VS Code application. There will only ever be one instance,
|
||||
* even if the user starts many instances (e.g. from the command line).
|
||||
@ -508,6 +511,16 @@ export class CodeApplication extends Disposable {
|
||||
});
|
||||
|
||||
//#endregion
|
||||
|
||||
// //#region Void IPC
|
||||
// validatedIpcMain.handle('vscode:sendLLMMessage', async (event, data) => {
|
||||
// try {
|
||||
// await this.sendLLMMessage(data);
|
||||
// } catch (error) {
|
||||
// console.error('Error sending LLM message:', error);
|
||||
// }
|
||||
// });
|
||||
// //#endregion
|
||||
}
|
||||
|
||||
private onUnexpectedError(error: Error): void {
|
||||
@ -998,6 +1011,9 @@ export class CodeApplication extends Disposable {
|
||||
break;
|
||||
}
|
||||
|
||||
// Void
|
||||
services.set(ISendLLMMessageService, new SyncDescriptor(SendLLMMessageService));
|
||||
|
||||
// Windows
|
||||
services.set(IWindowsMainService, new SyncDescriptor(WindowsMainService, [machineId, sqmId, devDeviceId, this.userEnv], false));
|
||||
services.set(IAuxiliaryWindowsMainService, new SyncDescriptor(AuxiliaryWindowsMainService, undefined, false));
|
||||
@ -1182,8 +1198,8 @@ export class CodeApplication extends Disposable {
|
||||
mainProcessElectronServer.registerChannel('keyboardLayout', keyboardLayoutChannel);
|
||||
|
||||
// Void
|
||||
const sendLLMMessageChannel = ProxyChannel.fromService(accessor.get(IEncryptionMainService), disposables);
|
||||
mainProcessElectronServer.registerChannel('sendLLMMessage', sendLLMMessageChannel);
|
||||
const sendLLMMessageChannel = ProxyChannel.fromService(accessor.get(ISendLLMMessageService), disposables);
|
||||
mainProcessElectronServer.registerChannel('void-channel-sendLLMMessage', sendLLMMessageChannel);
|
||||
|
||||
// Native host (main & shared process)
|
||||
this.nativeHostMainService = accessor.get(INativeHostMainService);
|
||||
|
@ -12,7 +12,7 @@ export interface IInlineDiffService {
|
||||
removeDiffs(editor: ICodeEditor): void;
|
||||
}
|
||||
|
||||
export const IInlineDiffService = createDecorator<IInlineDiffService>('inlineDiffService');
|
||||
export const IInlineDiffService = createDecorator<IInlineDiffService>('inlineDiffServiceOld');
|
||||
|
||||
class InlineDiffService extends Disposable implements IInlineDiffService {
|
||||
private readonly _diffDecorations = new Map<ICodeEditor, string[]>();
|
||||
|
@ -4,9 +4,9 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ISendLLMMessageService, SendLLMMessageParams } from '../common/sendLLMMessage.js';
|
||||
import { ProxyChannel } from '../../../../base/parts/ipc/common/ipc.js';
|
||||
import { IMainProcessService } from '../../../../platform/ipc/common/mainProcessService.js';
|
||||
import { InstantiationType, registerSingleton } from '../../../../platform/instantiation/common/extensions.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';
|
||||
|
||||
|
||||
// BROWSER IMPLEMENTATION OF SENDLLMMESSAGE
|
||||
@ -22,7 +22,7 @@ export class SendLLMMessageService implements ISendLLMMessageService {
|
||||
constructor(
|
||||
@IMainProcessService mainProcessService: IMainProcessService
|
||||
) {
|
||||
this._proxySendLLMService = ProxyChannel.toService<ISendLLMMessageService>(mainProcessService.getChannel('sendLLMMessage'));
|
||||
this._proxySendLLMService = ProxyChannel.toService<ISendLLMMessageService>(mainProcessService.getChannel('void-channel-sendLLMMessage'));
|
||||
}
|
||||
|
||||
sendLLMMessage(params: SendLLMMessageParams) {
|
@ -1,7 +1,7 @@
|
||||
// void/common/sendLLMMessage.ts
|
||||
|
||||
import { createDecorator } from '../../../../platform/instantiation/common/instantiation.js';
|
||||
import { VoidConfig } from '../../../contrib/void/browser/registerConfig.js';
|
||||
import { createDecorator } from '../../instantiation/common/instantiation.js';
|
||||
import { VoidConfig } from '../../../workbench/contrib/void/browser/registerConfig.js';
|
||||
|
||||
|
||||
|
20
src/vs/platform/void/electron-main/sendLLMMessage.ts
Normal file
20
src/vs/platform/void/electron-main/sendLLMMessage.ts
Normal file
@ -0,0 +1,20 @@
|
||||
// import { InstantiationType, registerSingleton } from '../../../../platform/instantiation/common/extensions.js';
|
||||
import { ISendLLMMessageService } from '../common/sendLLMMessage.js';
|
||||
import { sendLLMMessage } from '../../../workbench/contrib/void/browser/react/out/util/sendLLMMessage.js';
|
||||
// import { InstantiationType, registerSingleton } from '../../instantiation/common/extensions.js';
|
||||
// import { ipcMain } from 'electron';
|
||||
|
||||
// NODE IMPLEMENTATION OF SENDLLMMESSAGE
|
||||
export class SendLLMMessageService implements ISendLLMMessageService {
|
||||
readonly _serviceBrand: undefined;
|
||||
|
||||
async sendLLMMessage(data: any) {
|
||||
console.log('NODE sendLLMMessage', data);
|
||||
// ipcMain.emit('vscode:sendLLMMessage', data)
|
||||
|
||||
return sendLLMMessage(data)
|
||||
}
|
||||
}
|
||||
|
||||
// we don't need to register this, it's registered in app.ts:
|
||||
// registerSingleton(ISendLLMMessageService, SendLLMMessageService, InstantiationType.Delayed);
|
@ -5,6 +5,6 @@ A couple things to remember:
|
||||
|
||||
- Make sure to add .js at the end of any external imports used in here, e.g. ../../../../../my_file.js. If you don't do this, you will get untraceable errors.
|
||||
|
||||
- src/ needs to be shallow so the detection of externals works properly (see tsup.config.js).
|
||||
- src/ needs to be shallow (1 folder deep) so the detection of externals works properly (see tsup.config.js).
|
||||
|
||||
|
||||
|
@ -6,7 +6,6 @@ import React, { FormEvent, Fragment, useCallback, useEffect, useRef, useState }
|
||||
|
||||
|
||||
import { useConfigState, useService, useThreadsState } from '../util/services.js';
|
||||
import { sendLLMMessage } from '../util/sendLLMMessage.js';
|
||||
import { generateDiffInstructions } from '../../../prompt/systemPrompts.js';
|
||||
import { userInstructionsStr } from '../../../prompt/stringifyFiles.js';
|
||||
import { CodeSelection, CodeStagingSelection } from '../../../registerThreads.js';
|
||||
|
@ -4,8 +4,8 @@ import { Ollama } from 'ollama/browser'
|
||||
import { Content, GoogleGenerativeAI, GoogleGenerativeAIFetchError } from '@google/generative-ai';
|
||||
import { posthog } from 'posthog-js'
|
||||
import type { VoidConfig } from '../../../registerConfig.js';
|
||||
import type { LLMMessage, LLMMessageOnText, OnFinalMessage, } from '../../../../../../services/void/common/sendLLMMessage.js';
|
||||
import { SendLLMMessageParams } from '../../../../../../services/void/common/sendLLMMessage.js';
|
||||
import type { LLMMessage, LLMMessageOnText, OnFinalMessage, } from '../../../../../../../platform/void/common/sendLLMMessage.js';
|
||||
import { SendLLMMessageParams } from '../../../../../../../platform/void/common/sendLLMMessage.js';
|
||||
|
||||
type SendLLMMessageFnTypeInternal = (params: {
|
||||
messages: LLMMessage[];
|
||||
|
@ -28,7 +28,8 @@ import { ILanguageService } from '../../../../editor/common/languages/language.j
|
||||
import * as dom from '../../../../base/browser/dom.js';
|
||||
import { Widget } from '../../../../base/browser/ui/widget.js';
|
||||
import { URI } from '../../../../base/common/uri.js';
|
||||
import { ISendLLMMessageService } from '../../../services/void/common/sendLLMMessage.js';
|
||||
import { ISendLLMMessageService } from '../../../../platform/void/common/sendLLMMessage.js';
|
||||
// import { ISendLLMMessageService } from '../../../../platform/void/common/sendLLMMessage.js';
|
||||
// import { sendLLMMessage } from './react/out/util/sendLLMMessage.js';
|
||||
|
||||
|
||||
@ -116,7 +117,7 @@ export interface IInlineDiffsService {
|
||||
|
||||
}
|
||||
|
||||
export const IInlineDiffsService = createDecorator<IInlineDiffsService>('inlineDiffsService');
|
||||
export const IInlineDiffsService = createDecorator<IInlineDiffsService>('inlineDiffAreasService');
|
||||
|
||||
class InlineDiffsService extends Disposable implements IInlineDiffsService {
|
||||
_serviceBrand: undefined;
|
||||
|
@ -47,7 +47,7 @@ import { IVoidConfigStateService } from './registerConfig.js';
|
||||
import { IFileService } from '../../../../platform/files/common/files.js';
|
||||
import { IInlineDiffsService } from './registerInlineDiffs.js';
|
||||
import { IModelService } from '../../../../editor/common/services/model.js';
|
||||
import { ISendLLMMessageService } from '../../../services/void/common/sendLLMMessage.js';
|
||||
import { ISendLLMMessageService } from '../../../../platform/void/common/sendLLMMessage.js';
|
||||
// import { IClipboardService } from '../../../../platform/clipboard/common/clipboardService.js';
|
||||
|
||||
|
||||
|
@ -328,6 +328,11 @@ export class DesktopMain extends Disposable {
|
||||
//
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
// // Void
|
||||
// const sendLLMMessageService = new SendLLMMessageService();
|
||||
// serviceCollection.set(ISendLLMMessageService, sendLLMMessageService);
|
||||
|
||||
|
||||
|
||||
return { serviceCollection, logService, storageService, configurationService };
|
||||
}
|
||||
|
@ -1,17 +0,0 @@
|
||||
import { InstantiationType, registerSingleton } from '../../../../platform/instantiation/common/extensions.js';
|
||||
import { ISendLLMMessageService } from '../common/sendLLMMessage.js';
|
||||
|
||||
|
||||
// NODE IMPLEMENTATION OF SENDLLMMESSAGE
|
||||
|
||||
export class SendLLMMessageService implements ISendLLMMessageService {
|
||||
readonly _serviceBrand: undefined;
|
||||
|
||||
async sendLLMMessage(data: any): Promise<any> {
|
||||
console.log('NODE sendLLMMessage', data);
|
||||
// Your existing logic to send a message to the server
|
||||
// For example:
|
||||
// return fetch('https://your-server.com/api', { method: 'POST', body: JSON.stringify(data) });
|
||||
}
|
||||
}
|
||||
registerSingleton(ISendLLMMessageService, SendLLMMessageService, InstantiationType.Delayed);
|
@ -17,6 +17,7 @@ import './browser/workbench.contribution.js';
|
||||
//#region --- Void
|
||||
// Void added this:
|
||||
import './contrib/void/browser/void.contribution.js';
|
||||
import '../platform/void/browser/sendLLMMessage.js';
|
||||
//#endregion
|
||||
|
||||
|
||||
|
@ -31,13 +31,10 @@ import './electron-sandbox/parts/dialogs/dialog.contribution.js';
|
||||
|
||||
//#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
//#region --- Void
|
||||
// Void added this (modeling off of import '.*clipboardservice.js'):
|
||||
import './services/void/electron-sandbox/sendLLMMessage.js';
|
||||
//#endregion
|
||||
// //#region --- Void
|
||||
// // Void added this (modeling off of import '.*clipboardservice.js'):
|
||||
// import './services/void/electron-main/sendLLMMessage.js';
|
||||
// //#endregion
|
||||
|
||||
|
||||
|
||||
|
@ -33,11 +33,6 @@ import './browser/web.main.js';
|
||||
|
||||
|
||||
|
||||
//#region --- Void
|
||||
// Void added this (modeling off of import '.*clipboardservice.js'):
|
||||
import './services/void/browser/sendLLMMessage.js';
|
||||
//#endregion
|
||||
|
||||
|
||||
|
||||
//#region --- workbench services
|
||||
|
@ -77,6 +77,18 @@
|
||||
process.on(type, callback);
|
||||
}
|
||||
},
|
||||
|
||||
// Void : {
|
||||
// /**
|
||||
// * Send a message to the LLM.
|
||||
// * @param {any} data The data to send to the LLM.
|
||||
// * @returns {Promise<any>} The response from the LLM.
|
||||
// */
|
||||
// sendLLMMessage: async (data) => {
|
||||
// // Use ipcRenderer.invoke to send the message to the main process (see app.ts)
|
||||
// return await ipcRenderer.invoke('vscode:sendLLMMessage', data);
|
||||
// }
|
||||
// },
|
||||
};
|
||||
|
||||
if (process.contextIsolated) {
|
||||
|
Reference in New Issue
Block a user