Skip to content

Commit a81cb58

Browse files
committed
Multiple smaller fixes for field translation
1 parent a327dd2 commit a81cb58

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

ai.go

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,7 @@ CONSTRAINTS
749749
- Do NOT invent values
750750
- MUST use keys present in original JSON
751751
- Make sure all "Required data" values are in the output.
752+
- Do not focus on authentication unless necessary
752753
753754
END CONSTRAINTS
754755
---
@@ -1192,9 +1193,24 @@ func UpdateActionBody(action WorkflowAppAction) (string, error) {
11921193
}
11931194

11941195
// Uploads modifyable parameter data to file storage, as to be used in the future executions of the app
1195-
func UploadParameterBase(ctx context.Context, orgId, appId, actionName, paramName, paramValue string) error {
1196+
func UploadParameterBase(ctx context.Context, fields []Valuereplace, orgId, appId, actionName, paramName, paramValue string) error {
11961197
timeNow := time.Now().Unix()
11971198

1199+
// If NOT JSON:
1200+
// /rest/api/3/10010/comment -> /rest/api/3/{input.fields[i].key}/comment
1201+
// Does that mean we should look for the value in the data?
1202+
1203+
1204+
// Moving window to look for field.Value in the paramValue to directly replace
1205+
for _, field := range fields {
1206+
// Arbitrary limit (for now)
1207+
if len(field.Value) > 1024 {
1208+
continue
1209+
}
1210+
1211+
paramValue = strings.ReplaceAll(paramValue, field.Value, fmt.Sprintf("{%s}", field.Key))
1212+
}
1213+
11981214
// Check if the file already exists
11991215
fileId := fmt.Sprintf("file_parameter_%s-%s-%s-%s.json", orgId, strings.ToLower(appId), strings.Replace(strings.ToLower(actionName), " ", "_", -1), strings.ToLower(paramName))
12001216

@@ -6595,7 +6611,6 @@ SINGUL ACTIONS:
65956611

65966612
log.Printf("PARAM: %s", param.Value)
65976613
log.Printf("Systemmessage: %s", systemMessage)
6598-
//os.Exit(3)
65996614

66006615
systemMessage += "\n\n"
66016616
}
@@ -6724,7 +6739,6 @@ SINGUL ACTIONS:
67246739

67256740
_ = userMessageChanged
67266741
//log.Printf("[INFO] INFO NEXT NODE PREDICTIONS")
6727-
//os.Exit(3)
67286742
}
67296743

67306744
if lastFinishedIndex < -1 {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ require (
1616
github.com/bradfitz/slice v0.0.0-20180809154707-2b758aa73013
1717
github.com/docker/docker v28.3.3+incompatible
1818
github.com/frikky/kin-openapi v0.42.0
19-
github.com/frikky/schemaless v0.0.23
19+
github.com/frikky/schemaless v0.0.24
2020
github.com/go-git/go-billy/v5 v5.6.2
2121
github.com/go-git/go-git/v5 v5.16.1
2222
github.com/google/go-github/v28 v28.1.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2
127127
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
128128
github.com/frikky/kin-openapi v0.42.0 h1:d5Z6vnuQ6RnCCPIxZaDL+TH2ODLxT8abytOt+Zh+Kd0=
129129
github.com/frikky/kin-openapi v0.42.0/go.mod h1:ev9OZAw7Bv5p0w93j91++6a1ElPzGcCofst+kmrWsj4=
130-
github.com/frikky/schemaless v0.0.23 h1:fa1JR8HJat2obbAKB5+Rnwmr09LNUXlyjTMgKG/G7BA=
131-
github.com/frikky/schemaless v0.0.23/go.mod h1:m9s+6gALXhA5ZERCrJw+jI2rRtTPNa8mkl4vav9sxnY=
130+
github.com/frikky/schemaless v0.0.24 h1:1bNg96gm82yLbRlDS0haQH/96X3GlCAEuTCSasXIJZE=
131+
github.com/frikky/schemaless v0.0.24/go.mod h1:m9s+6gALXhA5ZERCrJw+jI2rRtTPNa8mkl4vav9sxnY=
132132
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
133133
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
134134
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=

0 commit comments

Comments
 (0)