Skip to content

Commit

Permalink
Feat/realtime audio (#3)
Browse files Browse the repository at this point in the history
* wip

* feat(cmd/voice-demo): enhance transcription pipeline with buffer management and logging

* chore(deps): remove unused golang.org/x/exp dependency

* feat(cli): integrate audio and text handling changes

* perf(logger): adjust log level to error

* refactor(term): move readline initialization to separate function

* feat(transcription): enhance buffer management and text reconciliation

* feat(cmd/voice-demo, internal/audio): adjust VAD configuration parameters

* refactor(cmd/cli): centralize provider and database init in cli package

* refactor(cli): use InitCodeDatabase for repository initialization

* refactor(cmd/cli): use cli.GenerateCompletion function

* refactor(cli): use IsTombStone from completion package

* chore(cli): remove unused imports and function

* fix(cli): handle context canceled and rendering errors

* refactor(cmd/cli): simplify provider initialization logic

* fix(cli): remove unnecessary error logging in input reading

* feat(cmd/cli): integrate realtime voice capabilities and refactor CLI components

* refactor(cmd/cli): restructure command initialization and execution

* chore(cmd/cli): remove unused output and plugin command files

* feat(internal/cli): introduce new internal CLI utility functions

* style(internal/cli): rename realtime voice file for consistency

* refactor(cli): remove deprecated realtime voice handling

* refactor(cmd/cli): modularize welcome message and input handling

* fix(internal/chat): update Reset method to retain latest state

* fix(internal/cli): handle empty conversation ID initialization

* refactor(cli): use WithDefaultIntrustructions for default CLI instructions

* refactor(cli/update): replace binName with binaryName constant

* feat(cmd/cli): re-enable config commands and improve audio handling

* refactor(internal/cli): extract help print and adjust welcome instructions

* feat(internal/config): revise configuration setup and dev mode handling

* feat(internal/cli): add support for /quit command to exit

* chore(cmd/cli): add TODO for replacing configSetCmd implementation

* refactor(cmd/cli): improve voice initialization and configuration management
  • Loading branch information
nullswan authored Oct 19, 2024
1 parent 460af6f commit d7f0d57
Show file tree
Hide file tree
Showing 39 changed files with 2,752 additions and 743 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
dist/
*.o
dev/
rfcs/
rfcs/
*.wav
nomi.log
109 changes: 55 additions & 54 deletions cmd/cli/config.go
Original file line number Diff line number Diff line change
@@ -1,66 +1,67 @@
package main

// import (
// "fmt"
// "log"
import (
"fmt"
"log"

// "gopkg.in/yaml.v2"
"gopkg.in/yaml.v2"

// "github.com/nullswan/nomi/internal/config"
// "github.com/spf13/cobra"
// )
"github.com/nullswan/nomi/internal/config"
"github.com/spf13/cobra"
)

// var configCmd = &cobra.Command{
// Use: "config",
// Short: "Manage configuration",
// Run: func(cmd *cobra.Command, args []string) {
// cmd.Help()
// },
// }
var configCmd = &cobra.Command{
Use: "config",
Short: "Manage configuration",
Run: func(cmd *cobra.Command, args []string) {
cmd.Help()
},
}

// var configShowCmd = &cobra.Command{
// Use: "show",
// Short: "Show current configuration",
// Run: func(cmd *cobra.Command, args []string) {
// data, err := yaml.Marshal(cfg)
// if err != nil {
// log.Fatalf("Error marshalling config: %v", err)
// }
var configShowCmd = &cobra.Command{
Use: "show",
Short: "Show current configuration",
Run: func(cmd *cobra.Command, args []string) {
data, err := yaml.Marshal(cfg)
if err != nil {
log.Fatalf("Error marshalling config: %v", err)
}

// fmt.Println(string(data))
// },
// }
fmt.Println(string(data))
},
}

// var configSetCmd = &cobra.Command{
// Use: "set [key] [value]",
// Short: "Set a configuration parameter",
// Args: cobra.ExactArgs(2),
// Run: func(cmd *cobra.Command, args []string) {
// key := args[0]
// value := args[1]
// TODO(nullswan): Replace with editor, just like with the prompt edit
var configSetCmd = &cobra.Command{
Use: "set [key] [value]",
Short: "Set a configuration parameter",
Args: cobra.ExactArgs(2),
Run: func(cmd *cobra.Command, args []string) {
key := args[0]
value := args[1]

// var err error
// err = config.SetConfigValue(cfg, key, value)
// if err != nil {
// log.Fatalf("Error setting configuration: %v", err)
// }
var err error
err = config.SetConfigValue(cfg, key, value)
if err != nil {
log.Fatalf("Error setting configuration: %v", err)
}

// err = config.SaveConfig(cfg)
// if err != nil {
// log.Fatalf("Error saving configuration: %v", err)
// }
err = config.SaveConfig(cfg)
if err != nil {
log.Fatalf("Error saving configuration: %v", err)
}

// fmt.Printf("Configuration '%s' set to '%s'\n", key, value)
// },
// }
fmt.Printf("Configuration '%s' set to '%s'\n", key, value)
},
}

// var configSetupCmd = &cobra.Command{
// Use: "setup",
// Short: "Set up initial configuration",
// Run: func(cmd *cobra.Command, args []string) {
// err := config.Setup()
// if err != nil {
// log.Fatalf("Error during setup: %v", err)
// }
// },
// }
var configSetupCmd = &cobra.Command{
Use: "setup",
Short: "Set up initial configuration",
Run: func(cmd *cobra.Command, args []string) {
err := config.Setup()
if err != nil {
log.Fatalf("Error during setup: %v", err)
}
},
}
Loading

0 comments on commit d7f0d57

Please sign in to comment.