gateway

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package gateway 实现 Golem 的 API 网关,允许通过 HTTP 协议与 Agent 进行交互。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(token string, processor ChatProcessor) http.Handler

NewHandler 创建并配置网关的路由处理器。

Types

type ChatProcessor

type ChatProcessor interface {
	// ProcessForChannel 处理来自指定通道和聊天 ID 的消息。
	ProcessForChannel(ctx context.Context, channel, chatID, senderID, content string) (string, error)
}

ChatProcessor 定义了网关处理聊天请求所需的接口。

type Server

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

Server 表示网关服务器实例。

func New

func New(cfg config.GatewayConfig, processor ChatProcessor) *Server

New 创建并返回一个新的网关服务器实例。

func (*Server) Addr

func (s *Server) Addr() string

Addr 返回服务器监听的完整地址。

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown 优雅地关闭网关服务器。

func (*Server) Start

func (s *Server) Start() error

Start 启动网关服务器并开始监听请求。

Jump to

Keyboard shortcuts

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