chat

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ChatCmd = &cobra.Command{
	Use:   "chat",
	Short: "Chat with Ava",
	Long:  `Chat with Ava.`,
	Run: func(cmd *cobra.Command, args []string) {
		logger := viper.Get("logger").(logger.ILogger)
		configuration := configuration.LoadConfiguration(logger)

		logger.Info("Chatting with Ava")

		chat, err := chat.NewChat(
			backend,
			configuration.AI.OpenAI.APIKey,
			logger,
			chat.WithLanguage(language),
			chat.WithConfigureAssistant(logger, configuration.Executors.Enabled),
		)
		if err != nil {
			logger.Fatal(err.Error())
		}

		if thread == "" {
			thread, err = chat.InitChat()
			if err != nil {
				logger.Fatal(err.Error())
			}
		}

		response, err := chat.Chat(message, thread)
		if err != nil {
			logger.Fatal(err.Error())
		}

		logger.Info(response)
		logger.Info(fmt.Sprintf("If you want to continue the conversation, use the --thread flag with the following value: %s", thread))

	},
}

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