feat: initialize Eino examples and ADK applications
Include chat, weather, image, travel, streaming ASR and text examples, shared model initialization, documentation, and existing tests. Co-authored-by: TRAE CLI <traecli@bytedance.com>
This commit is contained in:
commit
81deca8c8e
75 files changed
+7048
No files matched your search
@@ -0,0 +1,35 @@
|
||||
// Package cli 定义终端助手的文字与语音命令入口。
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"example.com/ueino/adk/internal/config"
|
||||
"example.com/ueino/adk/internal/terminal"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func NewCommand() *cobra.Command {
|
||||
return newCommand(terminal.Run)
|
||||
}
|
||||
|
||||
func newCommand(run func(context.Context, config.Config, bool) error) *cobra.Command {
|
||||
var cfg config.Config
|
||||
root := &cobra.Command{
|
||||
Use: "adk", Short: "Eino ADK 终端助手,默认使用文字聊天",
|
||||
Args: cobra.NoArgs, SilenceUsage: true, SilenceErrors: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return run(cmd.Context(), cfg.Resolve(), false)
|
||||
},
|
||||
}
|
||||
root.CompletionOptions.DisableDefaultCmd = true
|
||||
cfg.BindFlags(root.PersistentFlags())
|
||||
root.AddCommand(&cobra.Command{
|
||||
Use: "voice", Short: "使用麦克风进行语音聊天",
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return run(cmd.Context(), cfg.Resolve(), true)
|
||||
},
|
||||
})
|
||||
return root
|
||||
}
|
||||
Reference in new issue
Block a user