Skip to content

Commit 60ee4ac

Browse files
committed
Multiple minor tweaks
1 parent 46cae74 commit 60ee4ac

File tree

4 files changed

+32
-14
lines changed

4 files changed

+32
-14
lines changed

ai.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,7 @@ func FixContentOutput(contentOutput string) string {
13411341
contentOutput = strings.Trim(contentOutput, "\t")
13421342

13431343
// Fix issues with newlines in keys. Replace with raw newlines
1344-
contentOutput = strings.ReplaceAll(contentOutput, "\\n", "\n")
1344+
//contentOutput = strings.ReplaceAll(contentOutput, "\\n", "\n")
13451345

13461346
// Attempts to balance it automatically
13471347
contentOutput = balanceJSONLikeString(contentOutput)
@@ -11799,4 +11799,4 @@ func buildManualInputList(history []ConversationMessage, newPrompt string) []map
1179911799
})
1180011800

1180111801
return items
11802-
}
11802+
}

shared.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15081,6 +15081,13 @@ func HandleLogin(resp http.ResponseWriter, request *http.Request) {
1508115081
Expiration: expiration.Unix(),
1508215082
})
1508315083

15084+
// Singul handler
15085+
if project.Environment == "cloud" {
15086+
newCookie.Name = "__session"
15087+
newCookie.Domain = ".singul.io"
15088+
http.SetCookie(resp, newCookie)
15089+
}
15090+
1508415091
loginData = fmt.Sprintf(`{"success": true, "cookies": [{"key": "session_token", "value": "%s", "expiration": %d}], "region_url": "%s"}`, userdata.Session, expiration.Unix(), regionUrl)
1508515092
newData, err := json.Marshal(returnValue)
1508615093
if err == nil {
@@ -15138,6 +15145,13 @@ func HandleLogin(resp http.ResponseWriter, request *http.Request) {
1513815145
Expiration: expiration.Unix(),
1513915146
})
1514015147

15148+
// Singul handler
15149+
if project.Environment == "cloud" {
15150+
newCookie.Name = "__session"
15151+
newCookie.Domain = ".singul.io"
15152+
http.SetCookie(resp, newCookie)
15153+
}
15154+
1514115155
err = SetUser(ctx, &userdata, true)
1514215156
if err != nil {
1514315157
log.Printf("[ERROR] Failed updating user when setting session: %s", err)
@@ -24738,6 +24752,10 @@ func PrepareWorkflowExecution(ctx context.Context, workflow Workflow, request *h
2473824752
}
2473924753

2474024754
}
24755+
24756+
// Special weird mistake cases in apps without newlines
24757+
param.Value = strings.ReplaceAll(param.Value, "application/jsonContent-Type", "application/json\nContent-Type")
24758+
param.Value = strings.ReplaceAll(param.Value, "application/jsonAccept", "application/json\nAccept")
2474124759
}
2474224760

2474324761
if param.Name == "queries" {

stats.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ func IncrementCache(ctx context.Context, orgId, dataType string, amount ...int)
891891
return
892892
}
893893

894-
if len(orgId) != 36 {
894+
if len(orgId) != 36 && orgId != "public" {
895895
log.Printf("[ERROR] Increment Stats with bad OrgId '%s' for type '%s'", orgId, dataType)
896896
return
897897
}

structs.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ type AtomicOutput struct {
136136
ThreadId string `json:"thread_id"` // Thread the assistant ran
137137
RunId string `json:"run_id"` // Run ID for the thread
138138
ToolCallID string `json:"tool_call_id,omitempty"` // Result inside the run
139-
140-
ResponseId string `json:"response_id,omitempty"` // Response ID
141-
ConversationId string `json:"conversation_id,omitempty"` // Conversation ID
139+
140+
ResponseId string `json:"response_id,omitempty"` // Response ID
141+
ConversationId string `json:"conversation_id,omitempty"` // Conversation ID
142142
}
143143

144144
type ExecutionRequestWrapper struct {
@@ -1666,8 +1666,8 @@ type Notification struct {
16661666
Ignored bool `json:"ignored" datastore:"ignored"`
16671667
ExecutionId string `json:"execution_id" datastore:"execution_id"`
16681668

1669-
Severity string `json:"severity" datastore:"severity"`
1670-
Origin string `json:"origin" datastore:"origin"`
1669+
Severity string `json:"severity" datastore:"severity"`
1670+
Origin string `json:"origin" datastore:"origin"`
16711671
}
16721672

16731673
type NotificationCached struct {
@@ -3999,12 +3999,12 @@ type SchemalessOutput struct {
39993999
Status int `json:"status,omitempty"`
40004000
URL string `json:"url,omitempty"`
40014001

4002-
// Optional
4003-
RawResponse interface{} `json:"raw_response,omitempty"`
4002+
// JSON output. Or not? What if it's a list?
4003+
Output interface{} `json:"output,omitempty"`
40044004

4005-
// JSON output. What if it's a list?
4006-
//Output map[string]interface{} `json:"output"`
4007-
Output interface{} `json:"output"`
4005+
// Optional. Used for error handling.
4006+
RawResponse interface{} `json:"raw_response,omitempty"`
4007+
Retries int `json:"retries,omitempty"`
40084008
}
40094009

40104010
type CategoryActionFieldOverride struct {
@@ -4804,4 +4804,4 @@ type StreamData struct {
48044804
Type string `json:"type"` // "chunk", "done", "error"
48054805
Chunk string `json:"chunk,omitempty"`
48064806
Data string `json:"data,omitempty"` // For the final ID or error
4807-
}
4807+
}

0 commit comments

Comments
 (0)