Skip to content

Commit

Permalink
fix(entities-plugins): fields set to null (#1939)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leopoldthecoder authored Feb 11, 2025
1 parent 4771aad commit a400abf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,7 @@ const saveFormData = async (): Promise<void> => {
originalModel: formFieldsOriginal,
model: form.fields,
payload,
schema: schema.value,
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ export const aiProxyAdvancedSchema: CommonSchemaFields = {
// For the ai-proxy-advanced plugin, 'config-embeddings' and 'config-vectordb' fields are non-required
// but they have nested fields that are required. If the nested fields are not provided, 'config-embeddings'
// and 'config-vectordb' should be set to null in the payload.
shamefullyTransformPayload: ({ originalModel, model, payload }) => {
shamefullyTransformPayload: ({ originalModel, model, payload, schema }) => {
const isDirty = (key: string) => {
// if the field is required and the model value is not empty
// the field is dirty
if (schema[key]?.required && model[key]) {
return true
}

// if the model value is the same as the original value
// the field is not dirty
if (originalModel[key] === model[key]) {
Expand Down

0 comments on commit a400abf

Please sign in to comment.