Documentation
¶
Index ¶
- Constants
- func BuildSystemPrompt() string
- func GetAPIDoc(serviceOrRef string, api ...string) (string, error)
- func GetAPIEndpoint() string
- func GetCompactIndex() string
- func GetSkill() string
- func ListAPIs(service string) ([]string, error)
- func ListServices() ([]string, error)
- type Action
- type CurlResult
- type ExecCurlOptions
Constants ¶
View Source
const DefaultAPIEndpoint = "https://api.cnb.cool"
DefaultAPIEndpoint 是默认的 API 基础地址
Variables ¶
This section is empty.
Functions ¶
func BuildSystemPrompt ¶
func BuildSystemPrompt() string
BuildSystemPrompt 构建两阶段检索的 System Prompt 使用精简索引代替完整 SKILL.md,大幅减少 token 消耗 API 基础地址从环境变量 CNB_API_ENDPOINT 获取,默认为 https://api.cnb.cool
func GetAPIDoc ¶
GetAPIDoc 获取指定 API 的详细文档 支持两种调用方式:
GetAPIDoc("issues", "listissues") — 两个参数
GetAPIDoc("issues/listissues") — 单个 "service/apiname" 引用
func GetAPIEndpoint ¶
func GetAPIEndpoint() string
GetAPIEndpoint 从环境变量 CNB_API_ENDPOINT 获取 API 基础地址,默认为 https://api.cnb.cool
func GetCompactIndex ¶
func GetCompactIndex() string
GetCompactIndex 从 SKILL.md 生成精简索引(每个 API 一行) 格式: "- APIName: METHOD /path — 描述 service/apiname" 相比完整 SKILL.md (~2700行) 大幅缩减 token 消耗
func ListAPIs ¶
ListAPIs 返回指定服务下的所有 API 名称(不含 .md 扩展名)
Types ¶
type Action ¶
Action 表示从 AI 响应中解析出的动作指令
type CurlResult ¶
type CurlResult struct {
Success bool `json:"success"`
Data any `json:"data,omitempty"`
Error string `json:"error,omitempty"`
}
CurlResult 表示 curl 命令的执行结果
func ExecCurl ¶
func ExecCurl(curlCmd string, vars map[string]string, opts ...ExecCurlOptions) CurlResult
ExecCurl 执行 curl 命令 vars 为占位符替换映射,如 map[string]string{"<CNB_TOKEN>": "xxx", "{repo}": "owner/repo"}
Source Files
¶
- skills.go
Click to show internal directories.
Click to hide internal directories.