feat: add backend configuration and windows utilities, and initialize frontend dependencies

This commit is contained in:
jahruz67
2026-05-15 10:39:30 -07:00
parent e645102d3a
commit b0f4ea3e6f
43 changed files with 931 additions and 541 deletions
+8 -3
View File
@@ -26,7 +26,7 @@ const (
const (
DefaultWhisperModel = "whisper-large-v3-turbo"
DefaultAIModel = "llama-3.3-70b-versatile"
HTTPTimeout = 60 * time.Second
HTTPTimeout = 300 * time.Second
RefinementTemp = 0.3 // Temperature for text refinement (lower = more deterministic)
)
@@ -118,15 +118,20 @@ func (c *Client) TranscribeAudio(audioFilePath, language string) (string, error)
// RefineText uses an LLM to clean up and correct transcribed text.
// If the AI model is set to "None" or the API key is missing, returns the original text.
func (c *Client) RefineText(text string) (string, error) {
func (c *Client) RefineText(text string, activeContext string) (string, error) {
if c.apiKey == "" || c.aiModel == "None" {
return text, nil
}
systemPrompt := c.aiPrompt
if activeContext != "" {
systemPrompt += fmt.Sprintf("\n\nContext: The user is currently typing in a window titled '%s'. Please adapt the formatting appropriately (e.g. casual for chat apps, formal for email, code comments for IDEs). Do not mention the window title, just format appropriately.", activeContext)
}
payload := map[string]interface{}{
"model": c.aiModel,
"messages": []map[string]string{
{"role": "system", "content": c.aiPrompt},
{"role": "system", "content": systemPrompt},
{"role": "user", "content": text},
},
"temperature": RefinementTemp,
+8 -4
View File
@@ -261,7 +261,7 @@ func (m *Manager) Uninstall() error {
}
// Transcribe runs local whisper transcription
func (m *Manager) Transcribe(audioPath string) (string, error) {
func (m *Manager) Transcribe(audioPath string, language string) (string, error) {
if !m.IsInstalled() {
return "", fmt.Errorf("whisper is not installed")
}
@@ -280,11 +280,15 @@ func (m *Manager) Transcribe(audioPath string) (string, error) {
modelPath = filepath.Join(m.installDir, modelFilename)
}
logger.Info("Running whisper: %s -m %s -f %s", binaryPath, modelPath, audioPath)
if language == "" {
language = "auto"
}
// Run whisper with simple arguments: ./main -m model.bin -f audio.wav
logger.Info("Running whisper: %s -m %s -l %s -f %s", binaryPath, modelPath, language, audioPath)
// Run whisper with simple arguments: ./main -m model.bin -l language -f audio.wav
// Vulkan build uses GPU by default, no need for -ngl
cmd := exec.Command(binaryPath, "-m", modelPath, "-f", audioPath)
cmd := exec.Command(binaryPath, "-m", modelPath, "-l", language, "-f", audioPath)
// Set working directory to the binary's location so it can find DLLs
cmd.Dir = filepath.Dir(binaryPath)