web

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatRequest

type ChatRequest struct {
	Inputs          map[string]interface{}   `json:"inputs"`
	Query           string                   `json:"query"`
	Files           []map[string]interface{} `json:"files,omitempty"`
	ResponseMode    models.ResponseMode      `json:"response_mode,omitempty"`
	ConversationID  string                   `json:"conversation_id,omitempty"`
	ParentMessageID string                   `json:"parent_message_id,omitempty"`
	RetrieverFrom   string                   `json:"retriever_from,omitempty"`
}

ChatRequest 聊天请求

type Client

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

Client Web API客户端

func NewClient

func NewClient(appCode, baseURL string) *Client

NewClient 创建Web API客户端 (需要app code而不是api key)

func (*Client) AudioToText

func (c *Client) AudioToText(ctx context.Context, audioData []byte, filename string) (map[string]interface{}, error)

AudioToText 语音转文字

func (*Client) Chat

Chat 聊天对话

func (*Client) ChatStop

func (c *Client) ChatStop(ctx context.Context, taskID string) error

ChatStop 停止聊天

func (*Client) ChatStream

func (c *Client) ChatStream(ctx context.Context, req *ChatRequest, handler client.SSEHandler) error

ChatStream 流式聊天对话

func (*Client) CheckWebAppPermission

func (c *Client) CheckWebAppPermission(ctx context.Context, appID string) (*models.WebAppPermission, error)

CheckWebAppPermission 检查Web应用权限

func (*Client) Completion

func (c *Client) Completion(ctx context.Context, req *CompletionRequest) (*models.GenerateResponse, error)

Completion 文本补全

func (*Client) CompletionStop

func (c *Client) CompletionStop(ctx context.Context, taskID string) error

CompletionStop 停止文本补全

func (*Client) CompletionStream

func (c *Client) CompletionStream(ctx context.Context, req *CompletionRequest, handler client.SSEHandler) error

CompletionStream 流式文本补全

func (*Client) DeleteConversation

func (c *Client) DeleteConversation(ctx context.Context, conversationID string) error

DeleteConversation 删除对话

func (*Client) GetAppMeta

func (c *Client) GetAppMeta(ctx context.Context) (*models.AppMeta, error)

GetAppMeta 获取应用元数据

func (*Client) GetAppParameters

func (c *Client) GetAppParameters(ctx context.Context) (*models.AppParameters, error)

GetAppParameters 获取应用参数

func (*Client) GetConversations

func (c *Client) GetConversations(ctx context.Context, lastID string, limit int, pinned *bool, sortBy string) (*models.ConversationListResponse, error)

GetConversations 获取对话列表

func (*Client) GetMessageMoreLikeThis

func (c *Client) GetMessageMoreLikeThis(ctx context.Context, messageID string, responseMode models.ResponseMode) (*models.GenerateResponse, error)

GetMessageMoreLikeThis 获取类似消息

func (*Client) GetMessages

func (c *Client) GetMessages(ctx context.Context, conversationID string, firstID string, limit int) (*models.MessageListResponse, error)

GetMessages 获取消息列表

func (*Client) GetPassport

func (c *Client) GetPassport(ctx context.Context, userID string) error

GetPassport 获取访问令牌

func (*Client) GetSuggestedQuestions

func (c *Client) GetSuggestedQuestions(ctx context.Context, messageID string) (*models.SuggestedQuestionsResponse, error)

GetSuggestedQuestions 获取建议问题

func (*Client) GetWebAppAccessMode

func (c *Client) GetWebAppAccessMode(ctx context.Context, appID string, appCode string) (*models.WebAppAccessMode, error)

GetWebAppAccessMode 检查Web应用访问模式

func (*Client) PinConversation

func (c *Client) PinConversation(ctx context.Context, conversationID string) error

PinConversation 置顶对话

func (*Client) RenameConversation

func (c *Client) RenameConversation(ctx context.Context, conversationID string, request *models.ConversationRenameRequest) (*models.SimpleConversation, error)

RenameConversation 重命名对话

func (*Client) RunWorkflow

RunWorkflow 运行工作流

func (*Client) SendMessageFeedback

func (c *Client) SendMessageFeedback(ctx context.Context, messageID string, feedback *models.MessageFeedbackRequest) error

SendMessageFeedback 发送消息反馈

func (*Client) StopWorkflowTask

func (c *Client) StopWorkflowTask(ctx context.Context, taskID string) (*models.WorkflowStopResponse, error)

StopWorkflowTask 停止工作流任务

func (*Client) TextToAudio

func (c *Client) TextToAudio(ctx context.Context, req *TextToAudioRequest) (map[string]interface{}, error)

TextToAudio 文字转语音

func (*Client) UnpinConversation

func (c *Client) UnpinConversation(ctx context.Context, conversationID string) error

UnpinConversation 取消置顶对话

func (*Client) UploadFile

func (c *Client) UploadFile(ctx context.Context, filename string, fileData []byte, source string) (*models.FileUpload, error)

UploadFile 上传文件

type CompletionRequest

type CompletionRequest struct {
	Inputs        map[string]interface{}   `json:"inputs"`
	Query         string                   `json:"query,omitempty"`
	Files         []map[string]interface{} `json:"files,omitempty"`
	ResponseMode  models.ResponseMode      `json:"response_mode,omitempty"`
	RetrieverFrom string                   `json:"retriever_from,omitempty"`
}

CompletionRequest 文本补全请求

type PassportResponse

type PassportResponse struct {
	AccessToken string `json:"access_token"`
}

PassportResponse Passport响应

type TextToAudioRequest

type TextToAudioRequest struct {
	MessageID string `json:"message_id,omitempty"`
	Voice     string `json:"voice,omitempty"`
	Text      string `json:"text,omitempty"`
	Streaming bool   `json:"streaming,omitempty"`
}

TextToAudioRequest 文字转语音请求

Jump to

Keyboard shortcuts

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