Skip to content

Commit a229194

Browse files
committed
Merge branch 'main' of github.com:Shuffle/shuffle-shared
2 parents be9f126 + 1d0653d commit a229194

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

ai.go

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ func RunKmsTranslation(ctx context.Context, fullBody []byte, authConfig, paramNa
426426
}
427427

428428
// Added a filename_prefix to know which field each belongs to
429-
schemalessOutput, err := schemaless.Translate(ctx, "get_kms_key", marshalledBody, authConfig, fmt.Sprintf("filename_prefix:%s-", paramName))
429+
schemalessOutput, _, err := schemaless.Translate(ctx, "get_kms_key", marshalledBody, authConfig, fmt.Sprintf("filename_prefix:%s-", paramName))
430430
if err != nil {
431431
log.Printf("[ERROR] Failed to translate KMS response (2): %s", err)
432432
return string(fullBody), err
@@ -8944,11 +8944,30 @@ func RunAiQuery(systemMessage, userMessage string, incomingRequest ...openai.Cha
89448944
if len(chatCompletion.Messages) == 0 {
89458945
return "", errors.New("No messages to send to OpenAI. Pass systemmessage, usermessage")
89468946
}
8947+
}
8948+
8949+
// Gotta cut it back down, as it can get into 50+ etc
8950+
if len(chatCompletion.Messages) > 10 {
8951+
// Ensures we keep the system messages
8952+
newMessages := []openai.ChatCompletionMessage{
8953+
chatCompletion.Messages[0],
8954+
chatCompletion.Messages[1],
8955+
chatCompletion.Messages[2],
8956+
}
8957+
8958+
for messageIndex, chat := range chatCompletion.Messages {
8959+
if messageIndex > len(chatCompletion.Messages)-7 {
8960+
newMessages = append(newMessages, chat)
8961+
}
8962+
}
89478963

8948-
//log.Printf("\n\n\nGot %d messages in chat completion (%s)\n\n\n", len(chatCompletion.Messages), cachedChat)
8964+
if len(newMessages) > 5 {
8965+
chatCompletion.Messages = newMessages
8966+
}
89498967
}
89508968

89518969
if debug {
8970+
89528971
log.Printf("\n\n[DEBUG] Chatcompletion messages: %d\n\n", len(chatCompletion.Messages))
89538972
}
89548973

shared.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33352,7 +33352,7 @@ func checkExecutionStatus(ctx context.Context, exec *WorkflowExecution) *Workflo
3335233352
IncrementCache(ctx, exec.ExecutionOrg, "app_executions", amountFinished)
3335333353

3335433354
go RunCacheCleanup(ctx, *exec)
33355-
go RunIOCFinder(ctx, *exec)
33355+
//go RunIOCFinder(ctx, *exec)
3335633356

3335733357
//log.Printf("[DEBUG][%s] Running status fixing for workflow %#v to see if auth + workflow(s) are functional. Results: %d", exec.ExecutionId, exec.Workflow.ID, len(exec.Results))
3335833358
orgId := exec.ExecutionOrg

0 commit comments

Comments
 (0)