Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AgentCmd = &cobra.Command{ Use: "agent", Short: "agent", PersistentPreRun: func(cmd *cobra.Command, args []string) { var agentLog = logger.NewLog("agent") loader := config.NewConfigLoader() cfg, err := loader.GetConfig() if err != nil { agentLog.Panicw("load config error", "error", err) } friday.Fri, err = common.NewFriday(&cfg) if err != nil { agentLog.Errorf("init friday error: %v", err) } }, }
View Source
var ChatCmd = &cobra.Command{ Use: "chat", Short: "chat with llm base on knowledge", Run: func(cmd *cobra.Command, args []string) { if len(args) <= 1 { panic("dirId and history is needed.") } dirIdStr := args[0] dirId, err := strconv.Atoi(dirIdStr) if err != nil { panic(err) } historyStr := fmt.Sprint(strings.Join(args[1:], " ")) history := make([]map[string]string, 0) err = json.Unmarshal([]byte(historyStr), &history) if err != nil { panic(err) } if err := chat(int64(dirId), history); err != nil { panic(err) } }, }
View Source
var IngestCmd = &cobra.Command{ Use: "ingest", Short: "ingest knowledge", Run: func(cmd *cobra.Command, args []string) { if len(args) == 0 { panic("ingest path is needed") } ps := args[0] if err := ingest(ps); err != nil { panic(err) } }, }
View Source
var KeywordsCmd = &cobra.Command{ Use: "keywords", Short: "Extract keywords", Run: func(cmd *cobra.Command, args []string) { ps := args[0] if err := keywords(ps); err != nil { panic(err) } }, }
View Source
var QuestionCmd = &cobra.Command{ Use: "question", Short: "question base on knowledge", Run: func(cmd *cobra.Command, args []string) { question := fmt.Sprint(strings.Join(args, " ")) if err := run(question); err != nil { panic(err) } }, }
View Source
var ServeCmd = &cobra.Command{ Use: "serve", Short: "serve", Run: func(cmd *cobra.Command, args []string) { loader := config.NewConfigLoader() cfg, err := loader.GetConfig() if err != nil { panic(err) } if cfg.Debug { logger.SetDebug(true) } service.ChainPool = dispatch.NewPool(cfg.PoolNum) stop := utils.HandleTerminalSignal() wg := sync.WaitGroup{} s, err := api.NewHttpServer(cfg) if err != nil { panic(err) } wg.Add(1) go func() { defer wg.Done() s.Run(stop) }() wg.Wait() }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.