domain

package
v0.0.0-...-64045c7 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BillTableRemark   = "备注"
	BillTableCategory = "分类"
	BillTableAmount   = "金额"
	BillTableDate     = "日期"
	BillTableMonth    = "月份"
	BillTableExpenses = "收支"
	BillTableAuthor   = "花钱小能手"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AI

type AI struct {
	Introduction string
	Functions    []AIFunction
}

type AIChoices

type AIChoices struct {
	Index        int       `json:"index"`
	Message      AIMessage `json:"message"`
	FinishReason string    `json:"finish_reason"`
}

type AIFunction

type AIFunction struct {
	Name        string      `json:"name"`
	Description string      `json:"description"`
	Parameters  AIParameter `json:"parameters"`
}

type AIFunctionCall

type AIFunctionCall struct {
	Name      string `json:"name"`
	Arguments string `json:"arguments"`
}

type AIMessage

type AIMessage struct {
	Role         string          `json:"role"`
	Content      string          `json:"content"`
	FunctionCall *AIFunctionCall `json:"function_call,omitempty"`
}

type AIParameter

type AIParameter struct {
	Type       string                `json:"type"`
	Properties map[string]AIProperty `json:"properties"`
	Required   *[]string             `json:"required,omitempty"`
}

type AIProperty

type AIProperty struct {
	Type        string    `json:"type"`
	Description string    `json:"description"`
	Enum        *[]string `json:"enum,omitempty"`
}

type AIReq

type AIReq struct {
	Model     string       `json:"model"`
	Messages  []AIMessage  `json:"messages"`
	Functions []AIFunction `json:"functions"`
}

type AIResp

type AIResp struct {
	Id      string      `json:"id"`
	Object  string      `json:"object"`
	Created int         `json:"created"`
	Model   string      `json:"model"`
	Choices []AIChoices `json:"choices"`
	Usage   struct {
		PromptTokens     int `json:"prompt_tokens"`
		CompletionTokens int `json:"completion_tokens"`
		TotalTokens      int `json:"total_tokens"`
	} `json:"usage"`
}

type AIService

type AIService interface {
	CallFunctions(ctx context.Context, content string, ai AI) (*AIMessage, error)
}

type AuditLog

type AuditLog struct {
	Req, Resp, Key, Operator string
}

type AuditLogService

type AuditLogService interface {
	Send(log AuditLog)
	StartConsume()
}

type Bill

type Bill struct {
	Remark     string   `json:"remark"`
	Categories []string `json:"categories"`
	Amount     float64  `json:"amount"`
	Month      string   `json:"month"`
	Date       int64    `json:"date"`
	Expenses   string   `json:"expenses"`
	AuthorID   string   `json:"author_id"`
	AuthorName string   `json:"author_name"`
}

type BillRepository

type BillRepository interface {
	Save(appToken, tableToken string, bill *Bill) error
	Search(appToken, tableToken string, ss []db.SearchCmd) []*Bill
}

type Ledger

type Ledger struct {
	ID          string `json:"id"`
	AppToken    string `json:"app_token"`
	TableToken  string `json:"table_token"`
	Name        string `json:"name"`
	URL         string `json:"url"`
	CreatorID   string `json:"creator_id"`
	CreatorName string `json:"creator_name"`
}

type LedgerRepository

type LedgerRepository interface {
	Save(it *Ledger) error
	QueryByUID(UID string) (*Ledger, bool)
	QueryUnallocated() []*Ledger
	UpdateUser(id string, user User) error
	WarmUP(ctx context.Context)
}

type User

type User struct {
	UID  string `json:"uid"`
	Name string `json:"name"`
}

type UserRepository

type UserRepository interface {
	GetByID(UID string) (*User, bool)
	Save(user *User) (string, error)
	WarmUP(ctx context.Context)
}

Jump to

Keyboard shortcuts

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