Skip to content

Commit 483fddc

Browse files
committed
minor fixups
1 parent c4495ad commit 483fddc

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

api/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ func updateConfig(config *Config, input *OpenAIRequest) {
281281
n, exists := fnc["name"]
282282
if exists {
283283
nn, e := n.(string)
284-
if !e {
284+
if e {
285285
name = nn
286286
}
287287
}

api/openai.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -421,15 +421,15 @@ func chatEndpoint(cm *ConfigMerger, o *Option) func(c *fiber.Ctx) error {
421421

422422
processFunctions = true
423423

424+
// Append the no action function
425+
funcs = append(funcs, input.Functions...)
426+
funcs = append(funcs, noActionGrammar)
427+
424428
// Force picking one of the functions by the request
425429
if config.functionCallNameString != "" {
426430
funcs = funcs.Select(config.functionCallNameString)
427431
}
428432

429-
// Append the no action function
430-
funcs = append(funcs, input.Functions...)
431-
funcs = append(funcs, noActionGrammar)
432-
433433
// Update input grammar
434434
jsStruct := funcs.ToJSONStructure()
435435
config.Grammar = jsStruct.Grammar("")
@@ -452,7 +452,7 @@ func chatEndpoint(cm *ConfigMerger, o *Option) func(c *fiber.Ctx) error {
452452
roleFn := "assistant_function_call"
453453
r := config.Roles[roleFn]
454454
if r != "" {
455-
role = roleFn
455+
role = r
456456
}
457457
}
458458
r := config.Roles[role]

0 commit comments

Comments
 (0)