12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- package schema
- import (
- "entgo.io/ent"
- "entgo.io/ent/dialect/entsql"
- "entgo.io/ent/schema"
- "entgo.io/ent/schema/field"
- "entgo.io/ent/schema/index"
- "github.com/suyuan32/simple-admin-common/orm/ent/mixins"
- )
- // CompapiJob holds the schema definition for the CompapiJob entity.
- type CompapiAsynctask struct {
- ent.Schema
- }
- // Fields of the CompapiJob.
- func (CompapiAsynctask) Fields() []ent.Field {
- return []ent.Field{
- field.String("auth_token").Annotations(entsql.WithComments(true)).Comment("发起请求者的授权token"),
- field.String("event_type").Default("fastgpt").Annotations(entsql.WithComments(true)).Comment("请求目标类型"),
- field.String("chat_id").Optional().Default("").Annotations(entsql.WithComments(true)).Comment("会话ID"),
- field.Int8("workid_idx").Optional().Default(0).Annotations(entsql.WithComments(true)).Comment("workId在字典中的索引值"),
- field.String("openai_base").Annotations(entsql.WithComments(true)).Comment("待请求的大模型服务地址"),
- field.String("openai_key").Annotations(entsql.WithComments(true)).Comment("待请求的大模型服务密钥授权token"),
- field.String("request_raw").Annotations(entsql.WithComments(true)).Comment("请求参数结构字符串"),
- field.String("response_raw").Optional().Default("").Annotations(entsql.WithComments(true)).Comment("请求响应结构字符串"),
- field.String("callback_url").MaxLen(255).Annotations(entsql.WithComments(true)).Comment("异步执行回调地址"),
- //field.Int8("dist_status").Optional().Default(0).Annotations(entsql.WithComments(true)).Comment("dist status | 分发状态 0 未 1 已"),
- //field.Time("dist_at").Optional().Annotations(entsql.WithComments(true)).Comment("Dist Time | 分发时间"),
- field.Int8("task_status").Optional().Default(10).Annotations(entsql.WithComments(true)).Comment("callback_status | 任务完成状态 10 任务就绪 20 请求API完成 30 请求回调完成 60 任务暂停 70 任务失败"),
- field.Int8("retry_count").Optional().Default(0).Annotations(entsql.WithComments(true)).Comment("retry count | 重试次数"),
- field.String("last_error").Optional().Default("").Annotations(entsql.WithComments(true)).Comment("最后一次出错信息"),
- }
- }
- func (CompapiAsynctask) Mixin() []ent.Mixin {
- return []ent.Mixin{
- mixins.IDMixin{},
- }
- }
- func (CompapiAsynctask) Indexes() []ent.Index {
- return []ent.Index{
- //index.Fields("dist_status"),
- index.Fields("task_status"),
- }
- }
- func (CompapiAsynctask) Edges() []ent.Edge { return []ent.Edge{} }
- func (CompapiAsynctask) Annotations() []schema.Annotation {
- return []schema.Annotation{
- entsql.WithComments(true),
- entsql.Annotation{Table: "compapi_asynctask"},
- }
- }
|