ai

package
v0.0.0-...-5be73b4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service AI 服务

func NewService

func NewService(cfg *config.AIConfig) (*Service, error)

NewService 创建 AI 服务

func (*Service) Chat

func (s *Service) Chat(ctx context.Context, userMessage string) (string, error)

Chat 发送消息并获取回复

func (*Service) ClearHistory

func (s *Service) ClearHistory()

ClearHistory 清空消息历史

func (*Service) GetHistory

func (s *Service) GetHistory() []*models.Message

GetHistory 获取消息历史

func (*Service) SetHistory

func (s *Service) SetHistory(messages []*models.Message)

SetHistory 设置消息历史

func (*Service) StreamChat

func (s *Service) StreamChat(ctx context.Context, userMessage string, callback func(string) error) error

StreamChat 流式发送消息并获取回复

Jump to

Keyboard shortcuts

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