cmd

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Copyright © 2023 NAME HERE <EMAIL ADDRESS>

Copyright © 2023 NAME HERE <EMAIL ADDRESS>

Index

Constants

View Source
const (
	HOST       = "https://ai-talk.app"
	ConnectURL = HOST + "/connect?install_id=%s"
	TalkURL    = HOST + "/talks/%d"
	UploadAPI  = HOST + "/api/talks/upload"
)
View Source
const AuthHint = `` /* 260-byte string literal not displayed */
View Source
const FileHeader = `...
%s
...


`
View Source
const NAME = "aitalk"

Variables

View Source
var (
	VERSION = "0.2.0"

	Version                     bool
	Topic, Lang, Model          string
	OpenaiAPIHost, OpenaiAPIKey string
	Roles                       roles
	Duration                    time.Duration
)
View Source
var (
	GlobalInputCh    = make(chan string, 1)
	GlobalInputErrCh = make(chan error, 1)
)

TODO: remove this ugly global channel

Functions

func Execute

func Execute() error

Types

type AI

type AI struct {
	// contains filtered or unexported fields
}

func NewAI

func NewAI(name, host, apiKey, model string) (*AI, error)

func (*AI) IsAI

func (i *AI) IsAI() bool

func (*AI) Name

func (i *AI) Name() string

func (*AI) Query

func (i *AI) Query(ctx context.Context, prompts []string) (reply string, err error)

func (*AI) SetRole

func (i *AI) SetRole(role string)

type CreateResp

type CreateResp struct {
	Code int            `json:"code"`
	Msg  string         `json:"msg"`
	Data TalkCreateResp `json:"data"`
}

type Human

type Human struct {
	// contains filtered or unexported fields
}

func (*Human) IsAI

func (i *Human) IsAI() bool

func (*Human) Name

func (i *Human) Name() string

func (*Human) Query

func (i *Human) Query(ctx context.Context, prompts []string) (reply string, err error)

func (*Human) SetRole

func (i *Human) SetRole(string)

type Intelligence

type Intelligence interface {
	Name() string
	SetRole(string)
	Query(context.Context, []string) (string, error)
	IsAI() bool
}

type TalkCreateResp

type TalkCreateResp struct {
	ID int64 `json:"id"`
}

type UploadTalkReq

type UploadTalkReq struct {
	Model     string `json:"model" validate:"required"`
	Language  string `json:"lang" validate:"required"`
	RoleA     string `json:"roleA" validate:"required"`
	RoleB     string `json:"roleB" validate:"required"`
	Topic     string `json:"topic" validate:"required"`
	Content   string `json:"content" validate:"required"`
	InstallId string `json:"install_id" validate:"required"`
}

Jump to

Keyboard shortcuts

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