113 lines
4.0 KiB
Go
113 lines
4.0 KiB
Go
package entity
|
|
|
|
import "gitea.redpowerfuture.com/red-future/common/beans"
|
|
|
|
type modelGatewayModelCol struct {
|
|
beans.SQLBaseCol
|
|
ModelName string
|
|
ModelType string
|
|
BaseURL string
|
|
HttpMethod string
|
|
HeadMsg string
|
|
FormJSON string
|
|
RequestMapping string
|
|
ResponseMapping string
|
|
RequiredFields string
|
|
IsPrivate string
|
|
IsChatModel string
|
|
CallMode string
|
|
ApiKey string
|
|
Enabled string
|
|
MaxConcurrency string
|
|
TimeoutSeconds string
|
|
RetryTimes string
|
|
OperatorName string
|
|
ExtendMapping string
|
|
QueryConfig string
|
|
StreamConfig string
|
|
SpecialParams string
|
|
BillingConfig string
|
|
}
|
|
|
|
var ModelGatewayModelCol = modelGatewayModelCol{
|
|
SQLBaseCol: beans.DefSQLBaseCol,
|
|
ModelName: "model_name",
|
|
ModelType: "model_type",
|
|
BaseURL: "base_url",
|
|
HttpMethod: "http_method",
|
|
HeadMsg: "head_msg",
|
|
FormJSON: "form_json",
|
|
RequestMapping: "request_mapping",
|
|
ResponseMapping: "response_mapping",
|
|
RequiredFields: "required_fields",
|
|
IsPrivate: "is_private",
|
|
IsChatModel: "is_chat_model",
|
|
CallMode: "call_mode",
|
|
ApiKey: "api_key",
|
|
Enabled: "enabled",
|
|
MaxConcurrency: "max_concurrency",
|
|
TimeoutSeconds: "timeout_seconds",
|
|
RetryTimes: "retry_times",
|
|
OperatorName: "operator_name",
|
|
ExtendMapping: "extend_mapping",
|
|
QueryConfig: "query_config",
|
|
StreamConfig: "stream_config",
|
|
SpecialParams: "special_params",
|
|
BillingConfig: "billing_config",
|
|
}
|
|
|
|
type ModelGatewayModel struct {
|
|
beans.SQLBaseDO `orm:",inline"`
|
|
ModelName string `orm:"model_name" json:"modelName"`
|
|
OperatorName string `orm:"operator_name" json:"operatorName"`
|
|
ModelType int `orm:"model_type" json:"modelType"`
|
|
BaseURL string `orm:"base_url" json:"baseUrl"`
|
|
HttpMethod string `orm:"http_method" json:"httpMethod"`
|
|
HeadMsg map[string]any `orm:"head_msg" json:"headMsg"`
|
|
IsPrivate *int `orm:"is_private" json:"isPrivate"`
|
|
IsChatModel *int `orm:"is_chat_model" json:"isChatModel"`
|
|
CallMode *int `orm:"call_mode" json:"callMode"`
|
|
ApiKey string `orm:"api_key" json:"apiKey"`
|
|
Enabled *int `orm:"enabled" json:"enabled"`
|
|
Form []Form `orm:"form_json" json:"form"`
|
|
RequestMapping map[string]any `orm:"request_mapping" json:"requestMapping"`
|
|
ResponseMapping map[string]any `orm:"response_mapping" json:"responseMapping"`
|
|
ExtendMapping map[string]any `orm:"extend_mapping" json:"extendMapping"`
|
|
QueryConfig map[string]any `orm:"query_config" json:"queryConfig"`
|
|
StreamConfig map[string]any `orm:"stream_config" json:"streamConfig"`
|
|
SpecialParams map[string]any `orm:"special_params" json:"specialParams"`
|
|
BillingConfig map[string]any `orm:"billing_config" json:"billingConfig"`
|
|
RequiredFields []string `orm:"required_fields" json:"requiredFields"`
|
|
MaxConcurrency int `orm:"max_concurrency" json:"maxConcurrency"`
|
|
TimeoutSeconds int `orm:"timeout_seconds" json:"timeoutSeconds"`
|
|
RetryTimes int `orm:"retry_times" json:"retryTimes"`
|
|
}
|
|
|
|
type Form struct {
|
|
Key string `json:"key"`
|
|
Value any `json:"value"`
|
|
Label string `json:"label"`
|
|
Type string `json:"type"`
|
|
DefaultValue any `json:"defaultValue"`
|
|
Required bool `json:"required"`
|
|
IsForm bool `json:"isForm"`
|
|
Options []map[string]any `json:"options"`
|
|
Role string `json:"role"`
|
|
FieldConstraint FieldConstraint `json:"fieldConstraint"`
|
|
}
|
|
|
|
type FieldConstraint struct {
|
|
MaxLength int `json:"maxLength"`
|
|
MinLength int `json:"minLength"`
|
|
NumberType string `json:"numberType"`
|
|
Min any `json:"min"`
|
|
Max any `json:"max"`
|
|
MaxSize int `json:"maxSize"`
|
|
MaxCount int `json:"maxCount"`
|
|
Accept string `json:"accept"`
|
|
}
|
|
|
|
const (
|
|
ResponseBody = "content"
|
|
)
|