|
@@ -127,6 +127,11 @@ type AgentMutation struct {
|
|
|
addorganization_id *int64
|
|
|
dataset_id *string
|
|
|
collection_id *string
|
|
|
+ model *string
|
|
|
+ api_base *string
|
|
|
+ api_key *string
|
|
|
+ _type *int
|
|
|
+ add_type *int
|
|
|
clearedFields map[string]struct{}
|
|
|
wx_agent map[uint64]struct{}
|
|
|
removedwx_agent map[uint64]struct{}
|
|
@@ -437,9 +442,22 @@ func (m *AgentMutation) OldRole(ctx context.Context) (v string, err error) {
|
|
|
return oldValue.Role, nil
|
|
|
}
|
|
|
|
|
|
+// ClearRole clears the value of the "role" field.
|
|
|
+func (m *AgentMutation) ClearRole() {
|
|
|
+ m.role = nil
|
|
|
+ m.clearedFields[agent.FieldRole] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// RoleCleared returns if the "role" field was cleared in this mutation.
|
|
|
+func (m *AgentMutation) RoleCleared() bool {
|
|
|
+ _, ok := m.clearedFields[agent.FieldRole]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
// ResetRole resets all changes to the "role" field.
|
|
|
func (m *AgentMutation) ResetRole() {
|
|
|
m.role = nil
|
|
|
+ delete(m.clearedFields, agent.FieldRole)
|
|
|
}
|
|
|
|
|
|
// SetStatus sets the "status" field.
|
|
@@ -738,6 +756,223 @@ func (m *AgentMutation) ResetCollectionID() {
|
|
|
m.collection_id = nil
|
|
|
}
|
|
|
|
|
|
+// SetModel sets the "model" field.
|
|
|
+func (m *AgentMutation) SetModel(s string) {
|
|
|
+ m.model = &s
|
|
|
+}
|
|
|
+
|
|
|
+// Model returns the value of the "model" field in the mutation.
|
|
|
+func (m *AgentMutation) Model() (r string, exists bool) {
|
|
|
+ v := m.model
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldModel returns the old "model" field's value of the Agent entity.
|
|
|
+// If the Agent object wasn't provided to the builder, the object is fetched from the database.
|
|
|
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
|
|
+func (m *AgentMutation) OldModel(ctx context.Context) (v string, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldModel is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldModel requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldModel: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.Model, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ClearModel clears the value of the "model" field.
|
|
|
+func (m *AgentMutation) ClearModel() {
|
|
|
+ m.model = nil
|
|
|
+ m.clearedFields[agent.FieldModel] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// ModelCleared returns if the "model" field was cleared in this mutation.
|
|
|
+func (m *AgentMutation) ModelCleared() bool {
|
|
|
+ _, ok := m.clearedFields[agent.FieldModel]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetModel resets all changes to the "model" field.
|
|
|
+func (m *AgentMutation) ResetModel() {
|
|
|
+ m.model = nil
|
|
|
+ delete(m.clearedFields, agent.FieldModel)
|
|
|
+}
|
|
|
+
|
|
|
+// SetAPIBase sets the "api_base" field.
|
|
|
+func (m *AgentMutation) SetAPIBase(s string) {
|
|
|
+ m.api_base = &s
|
|
|
+}
|
|
|
+
|
|
|
+// APIBase returns the value of the "api_base" field in the mutation.
|
|
|
+func (m *AgentMutation) APIBase() (r string, exists bool) {
|
|
|
+ v := m.api_base
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldAPIBase returns the old "api_base" field's value of the Agent entity.
|
|
|
+// If the Agent object wasn't provided to the builder, the object is fetched from the database.
|
|
|
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
|
|
+func (m *AgentMutation) OldAPIBase(ctx context.Context) (v string, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldAPIBase is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldAPIBase requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldAPIBase: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.APIBase, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ClearAPIBase clears the value of the "api_base" field.
|
|
|
+func (m *AgentMutation) ClearAPIBase() {
|
|
|
+ m.api_base = nil
|
|
|
+ m.clearedFields[agent.FieldAPIBase] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// APIBaseCleared returns if the "api_base" field was cleared in this mutation.
|
|
|
+func (m *AgentMutation) APIBaseCleared() bool {
|
|
|
+ _, ok := m.clearedFields[agent.FieldAPIBase]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetAPIBase resets all changes to the "api_base" field.
|
|
|
+func (m *AgentMutation) ResetAPIBase() {
|
|
|
+ m.api_base = nil
|
|
|
+ delete(m.clearedFields, agent.FieldAPIBase)
|
|
|
+}
|
|
|
+
|
|
|
+// SetAPIKey sets the "api_key" field.
|
|
|
+func (m *AgentMutation) SetAPIKey(s string) {
|
|
|
+ m.api_key = &s
|
|
|
+}
|
|
|
+
|
|
|
+// APIKey returns the value of the "api_key" field in the mutation.
|
|
|
+func (m *AgentMutation) APIKey() (r string, exists bool) {
|
|
|
+ v := m.api_key
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldAPIKey returns the old "api_key" field's value of the Agent entity.
|
|
|
+// If the Agent object wasn't provided to the builder, the object is fetched from the database.
|
|
|
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
|
|
+func (m *AgentMutation) OldAPIKey(ctx context.Context) (v string, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldAPIKey is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldAPIKey requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldAPIKey: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.APIKey, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ClearAPIKey clears the value of the "api_key" field.
|
|
|
+func (m *AgentMutation) ClearAPIKey() {
|
|
|
+ m.api_key = nil
|
|
|
+ m.clearedFields[agent.FieldAPIKey] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// APIKeyCleared returns if the "api_key" field was cleared in this mutation.
|
|
|
+func (m *AgentMutation) APIKeyCleared() bool {
|
|
|
+ _, ok := m.clearedFields[agent.FieldAPIKey]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetAPIKey resets all changes to the "api_key" field.
|
|
|
+func (m *AgentMutation) ResetAPIKey() {
|
|
|
+ m.api_key = nil
|
|
|
+ delete(m.clearedFields, agent.FieldAPIKey)
|
|
|
+}
|
|
|
+
|
|
|
+// SetType sets the "type" field.
|
|
|
+func (m *AgentMutation) SetType(i int) {
|
|
|
+ m._type = &i
|
|
|
+ m.add_type = nil
|
|
|
+}
|
|
|
+
|
|
|
+// GetType returns the value of the "type" field in the mutation.
|
|
|
+func (m *AgentMutation) GetType() (r int, exists bool) {
|
|
|
+ v := m._type
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldType returns the old "type" field's value of the Agent entity.
|
|
|
+// If the Agent object wasn't provided to the builder, the object is fetched from the database.
|
|
|
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
|
|
+func (m *AgentMutation) OldType(ctx context.Context) (v int, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldType is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldType requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldType: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.Type, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddType adds i to the "type" field.
|
|
|
+func (m *AgentMutation) AddType(i int) {
|
|
|
+ if m.add_type != nil {
|
|
|
+ *m.add_type += i
|
|
|
+ } else {
|
|
|
+ m.add_type = &i
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedType returns the value that was added to the "type" field in this mutation.
|
|
|
+func (m *AgentMutation) AddedType() (r int, exists bool) {
|
|
|
+ v := m.add_type
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ClearType clears the value of the "type" field.
|
|
|
+func (m *AgentMutation) ClearType() {
|
|
|
+ m._type = nil
|
|
|
+ m.add_type = nil
|
|
|
+ m.clearedFields[agent.FieldType] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// TypeCleared returns if the "type" field was cleared in this mutation.
|
|
|
+func (m *AgentMutation) TypeCleared() bool {
|
|
|
+ _, ok := m.clearedFields[agent.FieldType]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetType resets all changes to the "type" field.
|
|
|
+func (m *AgentMutation) ResetType() {
|
|
|
+ m._type = nil
|
|
|
+ m.add_type = nil
|
|
|
+ delete(m.clearedFields, agent.FieldType)
|
|
|
+}
|
|
|
+
|
|
|
// AddWxAgentIDs adds the "wx_agent" edge to the Wx entity by ids.
|
|
|
func (m *AgentMutation) AddWxAgentIDs(ids ...uint64) {
|
|
|
if m.wx_agent == nil {
|
|
@@ -988,7 +1223,7 @@ func (m *AgentMutation) Type() string {
|
|
|
// order to get all numeric fields that were incremented/decremented, call
|
|
|
// AddedFields().
|
|
|
func (m *AgentMutation) Fields() []string {
|
|
|
- fields := make([]string, 0, 11)
|
|
|
+ fields := make([]string, 0, 15)
|
|
|
if m.created_at != nil {
|
|
|
fields = append(fields, agent.FieldCreatedAt)
|
|
|
}
|
|
@@ -1022,6 +1257,18 @@ func (m *AgentMutation) Fields() []string {
|
|
|
if m.collection_id != nil {
|
|
|
fields = append(fields, agent.FieldCollectionID)
|
|
|
}
|
|
|
+ if m.model != nil {
|
|
|
+ fields = append(fields, agent.FieldModel)
|
|
|
+ }
|
|
|
+ if m.api_base != nil {
|
|
|
+ fields = append(fields, agent.FieldAPIBase)
|
|
|
+ }
|
|
|
+ if m.api_key != nil {
|
|
|
+ fields = append(fields, agent.FieldAPIKey)
|
|
|
+ }
|
|
|
+ if m._type != nil {
|
|
|
+ fields = append(fields, agent.FieldType)
|
|
|
+ }
|
|
|
return fields
|
|
|
}
|
|
|
|
|
@@ -1052,6 +1299,14 @@ func (m *AgentMutation) Field(name string) (ent.Value, bool) {
|
|
|
return m.DatasetID()
|
|
|
case agent.FieldCollectionID:
|
|
|
return m.CollectionID()
|
|
|
+ case agent.FieldModel:
|
|
|
+ return m.Model()
|
|
|
+ case agent.FieldAPIBase:
|
|
|
+ return m.APIBase()
|
|
|
+ case agent.FieldAPIKey:
|
|
|
+ return m.APIKey()
|
|
|
+ case agent.FieldType:
|
|
|
+ return m.GetType()
|
|
|
}
|
|
|
return nil, false
|
|
|
}
|
|
@@ -1083,6 +1338,14 @@ func (m *AgentMutation) OldField(ctx context.Context, name string) (ent.Value, e
|
|
|
return m.OldDatasetID(ctx)
|
|
|
case agent.FieldCollectionID:
|
|
|
return m.OldCollectionID(ctx)
|
|
|
+ case agent.FieldModel:
|
|
|
+ return m.OldModel(ctx)
|
|
|
+ case agent.FieldAPIBase:
|
|
|
+ return m.OldAPIBase(ctx)
|
|
|
+ case agent.FieldAPIKey:
|
|
|
+ return m.OldAPIKey(ctx)
|
|
|
+ case agent.FieldType:
|
|
|
+ return m.OldType(ctx)
|
|
|
}
|
|
|
return nil, fmt.Errorf("unknown Agent field %s", name)
|
|
|
}
|
|
@@ -1169,6 +1432,34 @@ func (m *AgentMutation) SetField(name string, value ent.Value) error {
|
|
|
}
|
|
|
m.SetCollectionID(v)
|
|
|
return nil
|
|
|
+ case agent.FieldModel:
|
|
|
+ v, ok := value.(string)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetModel(v)
|
|
|
+ return nil
|
|
|
+ case agent.FieldAPIBase:
|
|
|
+ v, ok := value.(string)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetAPIBase(v)
|
|
|
+ return nil
|
|
|
+ case agent.FieldAPIKey:
|
|
|
+ v, ok := value.(string)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetAPIKey(v)
|
|
|
+ return nil
|
|
|
+ case agent.FieldType:
|
|
|
+ v, ok := value.(int)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetType(v)
|
|
|
+ return nil
|
|
|
}
|
|
|
return fmt.Errorf("unknown Agent field %s", name)
|
|
|
}
|
|
@@ -1183,6 +1474,9 @@ func (m *AgentMutation) AddedFields() []string {
|
|
|
if m.addorganization_id != nil {
|
|
|
fields = append(fields, agent.FieldOrganizationID)
|
|
|
}
|
|
|
+ if m.add_type != nil {
|
|
|
+ fields = append(fields, agent.FieldType)
|
|
|
+ }
|
|
|
return fields
|
|
|
}
|
|
|
|
|
@@ -1195,6 +1489,8 @@ func (m *AgentMutation) AddedField(name string) (ent.Value, bool) {
|
|
|
return m.AddedStatus()
|
|
|
case agent.FieldOrganizationID:
|
|
|
return m.AddedOrganizationID()
|
|
|
+ case agent.FieldType:
|
|
|
+ return m.AddedType()
|
|
|
}
|
|
|
return nil, false
|
|
|
}
|
|
@@ -1218,6 +1514,13 @@ func (m *AgentMutation) AddField(name string, value ent.Value) error {
|
|
|
}
|
|
|
m.AddOrganizationID(v)
|
|
|
return nil
|
|
|
+ case agent.FieldType:
|
|
|
+ v, ok := value.(int)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddType(v)
|
|
|
+ return nil
|
|
|
}
|
|
|
return fmt.Errorf("unknown Agent numeric field %s", name)
|
|
|
}
|
|
@@ -1229,6 +1532,9 @@ func (m *AgentMutation) ClearedFields() []string {
|
|
|
if m.FieldCleared(agent.FieldDeletedAt) {
|
|
|
fields = append(fields, agent.FieldDeletedAt)
|
|
|
}
|
|
|
+ if m.FieldCleared(agent.FieldRole) {
|
|
|
+ fields = append(fields, agent.FieldRole)
|
|
|
+ }
|
|
|
if m.FieldCleared(agent.FieldStatus) {
|
|
|
fields = append(fields, agent.FieldStatus)
|
|
|
}
|
|
@@ -1238,6 +1544,18 @@ func (m *AgentMutation) ClearedFields() []string {
|
|
|
if m.FieldCleared(agent.FieldExamples) {
|
|
|
fields = append(fields, agent.FieldExamples)
|
|
|
}
|
|
|
+ if m.FieldCleared(agent.FieldModel) {
|
|
|
+ fields = append(fields, agent.FieldModel)
|
|
|
+ }
|
|
|
+ if m.FieldCleared(agent.FieldAPIBase) {
|
|
|
+ fields = append(fields, agent.FieldAPIBase)
|
|
|
+ }
|
|
|
+ if m.FieldCleared(agent.FieldAPIKey) {
|
|
|
+ fields = append(fields, agent.FieldAPIKey)
|
|
|
+ }
|
|
|
+ if m.FieldCleared(agent.FieldType) {
|
|
|
+ fields = append(fields, agent.FieldType)
|
|
|
+ }
|
|
|
return fields
|
|
|
}
|
|
|
|
|
@@ -1255,6 +1573,9 @@ func (m *AgentMutation) ClearField(name string) error {
|
|
|
case agent.FieldDeletedAt:
|
|
|
m.ClearDeletedAt()
|
|
|
return nil
|
|
|
+ case agent.FieldRole:
|
|
|
+ m.ClearRole()
|
|
|
+ return nil
|
|
|
case agent.FieldStatus:
|
|
|
m.ClearStatus()
|
|
|
return nil
|
|
@@ -1264,6 +1585,18 @@ func (m *AgentMutation) ClearField(name string) error {
|
|
|
case agent.FieldExamples:
|
|
|
m.ClearExamples()
|
|
|
return nil
|
|
|
+ case agent.FieldModel:
|
|
|
+ m.ClearModel()
|
|
|
+ return nil
|
|
|
+ case agent.FieldAPIBase:
|
|
|
+ m.ClearAPIBase()
|
|
|
+ return nil
|
|
|
+ case agent.FieldAPIKey:
|
|
|
+ m.ClearAPIKey()
|
|
|
+ return nil
|
|
|
+ case agent.FieldType:
|
|
|
+ m.ClearType()
|
|
|
+ return nil
|
|
|
}
|
|
|
return fmt.Errorf("unknown Agent nullable field %s", name)
|
|
|
}
|
|
@@ -1305,6 +1638,18 @@ func (m *AgentMutation) ResetField(name string) error {
|
|
|
case agent.FieldCollectionID:
|
|
|
m.ResetCollectionID()
|
|
|
return nil
|
|
|
+ case agent.FieldModel:
|
|
|
+ m.ResetModel()
|
|
|
+ return nil
|
|
|
+ case agent.FieldAPIBase:
|
|
|
+ m.ResetAPIBase()
|
|
|
+ return nil
|
|
|
+ case agent.FieldAPIKey:
|
|
|
+ m.ResetAPIKey()
|
|
|
+ return nil
|
|
|
+ case agent.FieldType:
|
|
|
+ m.ResetType()
|
|
|
+ return nil
|
|
|
}
|
|
|
return fmt.Errorf("unknown Agent field %s", name)
|
|
|
}
|