mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-04-19 03:47:26 +00:00
task_relay_info
This commit is contained in:
@@ -116,6 +116,7 @@ type RelayInfo struct {
|
||||
*RerankerInfo
|
||||
*ResponsesUsageInfo
|
||||
*ChannelMeta
|
||||
*TaskRelayInfo
|
||||
}
|
||||
|
||||
func (info *RelayInfo) InitChannelMeta(c *gin.Context) {
|
||||
@@ -400,6 +401,10 @@ func genBaseRelayInfo(c *gin.Context, request dto.Request) *RelayInfo {
|
||||
},
|
||||
}
|
||||
|
||||
if info.RelayMode == relayconstant.RelayModeUnknown {
|
||||
info.RelayMode = c.GetInt("relay_mode")
|
||||
}
|
||||
|
||||
if strings.HasPrefix(c.Request.URL.Path, "/pg") {
|
||||
info.IsPlayground = true
|
||||
info.RequestURLPath = strings.TrimPrefix(info.RequestURLPath, "/pg")
|
||||
@@ -465,25 +470,12 @@ func (info *RelayInfo) HasSendResponse() bool {
|
||||
}
|
||||
|
||||
type TaskRelayInfo struct {
|
||||
*RelayInfo
|
||||
Action string
|
||||
OriginTaskID string
|
||||
|
||||
ConsumeQuota bool
|
||||
}
|
||||
|
||||
func GenTaskRelayInfo(c *gin.Context) (*TaskRelayInfo, error) {
|
||||
relayInfo, err := GenRelayInfo(c, types.RelayFormatTask, nil, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
info := &TaskRelayInfo{
|
||||
RelayInfo: relayInfo,
|
||||
}
|
||||
info.InitChannelMeta(c)
|
||||
return info, nil
|
||||
}
|
||||
|
||||
type TaskSubmitReq struct {
|
||||
Prompt string `json:"prompt"`
|
||||
Model string `json:"model,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user