chore(cleanup): remove document drag-and-drop
Remove the feature that let a user drop a .txt/.md/.csv/.docx/.pdf file onto the avatar to feed its text into the chat: the dropped-files IPC handler and extractText() in main, and getPathForFile/sendDroppedFiles in the preload API and renderer App.tsx. This fed documents into the general-purpose chat loop, which is being phased out in favor of the server-side coach pipeline. Uninstall mammoth and pdf-parse, now unused. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
6cb38a2f36
commit
acdd8a08d3
@@ -4,8 +4,7 @@ import { join } from 'path'
|
||||
import { electronApp, optimizer, is } from '@electron-toolkit/utils'
|
||||
import { transcribeAudio, synthesizeSpeech } from './ai/elevenlabs'
|
||||
import { getAssistantReply } from './ai/openrouter'
|
||||
import { setMainWindow, sendToRenderer } from './windowBridge'
|
||||
import { extractText } from './skills/documents/extractText'
|
||||
import { setMainWindow } from './windowBridge'
|
||||
import { stripWakeWord } from './wakeWord'
|
||||
import { loginAndLoadKeys } from './auth/authClient'
|
||||
import { openLoginWindow, closeLoginWindow } from './auth/loginWindow'
|
||||
@@ -167,35 +166,6 @@ app
|
||||
if (window) menu.popup({ window })
|
||||
})
|
||||
|
||||
ipcMain.on('dropped-files', (_event, paths: string[]) => {
|
||||
void (async () => {
|
||||
const path = paths[0]
|
||||
if (!path) return
|
||||
|
||||
let prompt: string
|
||||
try {
|
||||
const doc = await extractText(path)
|
||||
const note = doc.truncated ? ' (contenu tronque, document tres long)' : ''
|
||||
prompt = `[Evenement systeme] L'utilisateur vient de deposer le fichier "${doc.name}" sur ton avatar${note}. Voici son contenu :\n\n${doc.text}\n\nPresente en une phrase ce que tu as recu et demande-lui ce qu'il veut que tu en fasses (resume, traduction, correction orthographique, conversion de format, restructuration, ou autre chose). N'effectue aucune action pour l'instant, attends sa reponse.`
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error)
|
||||
prompt = `[Evenement systeme] L'utilisateur vient de deposer un fichier sur ton avatar mais tu n'as pas pu le lire (${message}). Explique-lui brievement le probleme.`
|
||||
}
|
||||
|
||||
try {
|
||||
const reply = await getAssistantReply(prompt)
|
||||
const speech = await synthesizeSpeech(reply)
|
||||
const audio = speech.buffer.slice(
|
||||
speech.byteOffset,
|
||||
speech.byteOffset + speech.byteLength
|
||||
) as ArrayBuffer
|
||||
sendToRenderer('proactive-speech', audio)
|
||||
} catch (error) {
|
||||
console.error('[dropped-files]', error)
|
||||
}
|
||||
})()
|
||||
})
|
||||
|
||||
ipcMain.handle(
|
||||
'voice-turn',
|
||||
async (_event, inputAudio: ArrayBuffer, mimeType: string): Promise<VoiceTurnResult> => {
|
||||
|
||||
Reference in New Issue
Block a user