Documentation
¶
Index ¶
- Variables
- func GetOAuthTokenFromCookie(ctx context.Context, r *http.Request) string
- func OAuthContextWithToken(ctx context.Context, token string) context.Context
- func OAuthTokenFromContext(ctx context.Context) string
- func OAuthTokenMiddleware(getToken GetOAuthTokenFunc) func(http.Handler) http.Handler
- type ChatMessage
- type ChatRequest
- type ChatResponse
- type Done
- type Failure
- type GetOAuthTokenFunc
- type M
- type ResultData
- type ResultID
- type SummaryRequest
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var (
UserFromContext = staffio.UserFromContext
)
vars from staffio
Functions ¶
func GetOAuthTokenFromCookie ¶
GetOAuthTokenFromCookie 从 cookie 获取 token(当前实现) tokenCN 需要与 handle_user.go 中的保持一致
func OAuthContextWithToken ¶
OAuthContextWithToken 将 token 添加到 context
func OAuthTokenFromContext ¶
OAuthTokenFromContext 从 context 获取 token
func OAuthTokenMiddleware ¶
func OAuthTokenMiddleware(getToken GetOAuthTokenFunc) func(http.Handler) http.Handler
OAuthTokenMiddleware 创建中间件,将 cookie 中的 token 注入 context
Types ¶
type ChatMessage ¶
type ChatMessage struct {
ID string `json:"id,omitempty"`
Delta string `json:"delta,omitempty"`
Text string `json:"text,omitempty"`
Role string `json:"role,omitempty"`
Name string `json:"name,omitempty"`
// For Role=assistant prompts this may be set to the tool calls generated by the model, such as function calls.
ToolCalls []map[string]any `json:"tool_calls,omitempty"`
// For Role=tool prompts this should be set to the ID given in the assistant's prior request to call a tool.
ToolCallID string `json:"tool_call_id,omitempty"`
FinishReason string `json:"finishReason,omitempty"`
ConversationID string `json:"csid,omitempty"`
Title string `json:"title,omitempty"`
}
type ChatRequest ¶
type ChatRequest struct {
Prompt string `json:"prompt"`
ConversationID string `json:"csid"`
ParentMessageID string `json:"pmid"` // TODO: rename to PreviousMessageID
Regenerate bool `json:"regen"`
Stream bool `json:"stream"`
MCPs []string `json:"mcps,omitempty"`
// deprecated: for github.com/Chanzhaoyu/chatgpt-web only
Options struct {
ConversationId string `json:"conversationId,omitempty"`
} `json:"options,omitempty"`
}
func (*ChatRequest) GetConversionID ¶
func (z *ChatRequest) GetConversionID() string
type ChatResponse ¶
type ChatResponse struct {
// contains filtered or unexported fields
}
type GetOAuthTokenFunc ¶
GetOAuthTokenFunc 用于获取 OAuth token 的函数类型 将来可能从 Redis/DB 获取,当前从 cookie 获取
type ResultData ¶
type ResultData = resp.ResultData
type SummaryRequest ¶
SummaryRequest 摘要请求
Click to show internal directories.
Click to hide internal directories.