Merge branch 'refactor/0712_ask' of https://github.com/pickle-com/glass into refactor/0712_ask

This commit is contained in:
samtiz 2025-07-13 11:08:43 +09:00
commit 586d44e57b
6 changed files with 20 additions and 20 deletions

2
aec

@ -1 +1 @@
Subproject commit f00bb1fb948053c752b916adfee19f90644a0b2f Subproject commit 9e11f4f95707714464194bdfc9db0222ec5c6163

View File

@ -70,16 +70,16 @@ module.exports = {
ipcMain.handle('stop-screen-capture', async () => askService.handleStopScreenCapture()); ipcMain.handle('stop-screen-capture', async () => askService.handleStopScreenCapture());
// Listen // Listen
ipcMain.handle('send-audio-content', async (event, { data, mimeType }) => await listenService.handleSendAudioContent(data, mimeType)); ipcMain.handle('listen:sendMicAudio', async (event, { data, mimeType }) => await listenService.handleSendMicAudioContent(data, mimeType));
ipcMain.handle('send-system-audio-content', async (event, { data, mimeType }) => { ipcMain.handle('listen:sendSystemAudio', async (event, { data, mimeType }) => {
const result = await listenService.sttService.sendSystemAudioContent(data, mimeType); const result = await listenService.sttService.sendSystemAudioContent(data, mimeType);
if(result.success) { if(result.success) {
listenService.sendToRenderer('system-audio-data', { data }); listenService.sendToRenderer('system-audio-data', { data });
} }
return result; return result;
}); });
ipcMain.handle('start-macos-audio', async () => await listenService.handleStartMacosAudio()); ipcMain.handle('listen:startMacosSystemAudio', async () => await listenService.handleStartMacosAudio());
ipcMain.handle('stop-macos-audio', async () => await listenService.handleStopMacosAudio()); ipcMain.handle('listen:stopMacosSystemAudio', async () => await listenService.handleStopMacosAudio());
ipcMain.handle('update-google-search-setting', async (event, enabled) => await listenService.handleUpdateGoogleSearchSetting(enabled)); ipcMain.handle('update-google-search-setting', async (event, enabled) => await listenService.handleUpdateGoogleSearchSetting(enabled));
ipcMain.handle('listen:changeSession', async (event, listenButtonText) => { ipcMain.handle('listen:changeSession', async (event, listenButtonText) => {
console.log('[FeatureBridge] listen:changeSession from mainheader', listenButtonText); console.log('[FeatureBridge] listen:changeSession from mainheader', listenButtonText);

View File

@ -205,8 +205,8 @@ class ListenService {
} }
} }
async sendAudioContent(data, mimeType) { async sendMicAudioContent(data, mimeType) {
return await this.sttService.sendAudioContent(data, mimeType); return await this.sttService.sendMicAudioContent(data, mimeType);
} }
async startMacOSAudioCapture() { async startMacOSAudioCapture() {
@ -280,8 +280,8 @@ class ListenService {
} }
// `_createHandler`를 사용하여 핸들러들을 동적으로 생성합니다. // `_createHandler`를 사용하여 핸들러들을 동적으로 생성합니다.
handleSendAudioContent = this._createHandler( handleSendMicAudioContent = this._createHandler(
this.sendAudioContent, this.sendMicAudioContent,
null, null,
'Error sending user audio:' 'Error sending user audio:'
); );

View File

@ -400,7 +400,7 @@ class SttService {
return true; return true;
} }
async sendAudioContent(data, mimeType) { async sendMicAudioContent(data, mimeType) {
// const provider = await this.getAiProvider(); // const provider = await this.getAiProvider();
// const isGemini = provider === 'gemini'; // const isGemini = provider === 'gemini';

View File

@ -271,10 +271,10 @@ contextBridge.exposeInMainWorld('api', {
// src/ui/listen/audioCore/listenCapture.js // src/ui/listen/audioCore/listenCapture.js
listenCapture: { listenCapture: {
// Audio Management // Audio Management
sendAudioContent: (data) => ipcRenderer.invoke('send-audio-content', data), sendMicAudioContent: (data) => ipcRenderer.invoke('listen:sendMicAudio', data),
sendSystemAudioContent: (data) => ipcRenderer.invoke('send-system-audio-content', data), sendSystemAudioContent: (data) => ipcRenderer.invoke('listen:sendSystemAudio', data),
startMacosAudio: () => ipcRenderer.invoke('start-macos-audio'), startMacosSystemAudio: () => ipcRenderer.invoke('listen:startMacosSystemAudio'),
stopMacosAudio: () => ipcRenderer.invoke('stop-macos-audio'), stopMacosSystemAudio: () => ipcRenderer.invoke('listen:stopMacosSystemAudio'),
// Screen Capture // Screen Capture
captureScreenshot: (options) => ipcRenderer.invoke('capture-screenshot', options), captureScreenshot: (options) => ipcRenderer.invoke('capture-screenshot', options),

View File

@ -335,7 +335,7 @@ async function setupMicProcessing(micStream) {
const pcm16 = convertFloat32ToInt16(processedChunk); const pcm16 = convertFloat32ToInt16(processedChunk);
const b64 = arrayBufferToBase64(pcm16.buffer); const b64 = arrayBufferToBase64(pcm16.buffer);
window.api.listenCapture.sendAudioContent({ window.api.listenCapture.sendMicAudioContent({
data: b64, data: b64,
mimeType: 'audio/pcm;rate=24000', mimeType: 'audio/pcm;rate=24000',
}); });
@ -368,7 +368,7 @@ function setupLinuxMicProcessing(micStream) {
const pcmData16 = convertFloat32ToInt16(chunk); const pcmData16 = convertFloat32ToInt16(chunk);
const base64Data = arrayBufferToBase64(pcmData16.buffer); const base64Data = arrayBufferToBase64(pcmData16.buffer);
await window.api.listenCapture.sendAudioContent({ await window.api.listenCapture.sendMicAudioContent({
data: base64Data, data: base64Data,
mimeType: 'audio/pcm;rate=24000', mimeType: 'audio/pcm;rate=24000',
}); });
@ -517,15 +517,15 @@ async function startCapture(screenshotIntervalSeconds = 5, imageQuality = 'mediu
console.log('Starting macOS capture with SystemAudioDump...'); console.log('Starting macOS capture with SystemAudioDump...');
// Start macOS audio capture // Start macOS audio capture
const audioResult = await window.api.listenCapture.startMacosAudio(); const audioResult = await window.api.listenCapture.startMacosSystemAudio();
if (!audioResult.success) { if (!audioResult.success) {
console.warn('[listenCapture] macOS audio start failed:', audioResult.error); console.warn('[listenCapture] macOS audio start failed:', audioResult.error);
// 이미 실행 중 → stop 후 재시도 // 이미 실행 중 → stop 후 재시도
if (audioResult.error === 'already_running') { if (audioResult.error === 'already_running') {
await window.api.listenCapture.stopMacosAudio(); await window.api.listenCapture.stopMacosSystemAudio();
await new Promise(r => setTimeout(r, 500)); await new Promise(r => setTimeout(r, 500));
const retry = await window.api.listenCapture.startMacosAudio(); const retry = await window.api.listenCapture.startMacosSystemAudio();
if (!retry.success) { if (!retry.success) {
throw new Error('Retry failed: ' + retry.error); throw new Error('Retry failed: ' + retry.error);
} }
@ -720,7 +720,7 @@ function stopCapture() {
// Stop macOS audio capture if running // Stop macOS audio capture if running
if (isMacOS) { if (isMacOS) {
window.api.listenCapture.stopMacosAudio().catch(err => { window.api.listenCapture.stopMacosSystemAudio().catch(err => {
console.error('Error stopping macOS audio:', err); console.error('Error stopping macOS audio:', err);
}); });
} }