apps

package
v0.0.0-...-f03bf9e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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 SummaryCmd = &cobra.Command{
	Use:   "summary",
	Short: "Summarize an article in short words",
	Run: func(cmd *cobra.Command, args []string) {
		ps := args[0]

		if err := summary(ps); err != nil {
			panic(err)
		}
	},
}
View Source
var WeChatCmd = &cobra.Command{
	Use:   "chat",
	Short: "conclusion base on chat",
	Run: func(cmd *cobra.Command, args []string) {
		ps := fmt.Sprint(strings.Join(args, " "))

		if err := wechat(ps); err != nil {
			panic(err)
		}
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL