|
|
@ -421,15 +421,15 @@ func chatEndpoint(cm *ConfigMerger, o *Option) func(c *fiber.Ctx) error { |
|
|
|
|
|
|
|
|
|
|
|
processFunctions = true |
|
|
|
processFunctions = true |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Append the no action function
|
|
|
|
|
|
|
|
funcs = append(funcs, input.Functions...) |
|
|
|
|
|
|
|
funcs = append(funcs, noActionGrammar) |
|
|
|
|
|
|
|
|
|
|
|
// Force picking one of the functions by the request
|
|
|
|
// Force picking one of the functions by the request
|
|
|
|
if config.functionCallNameString != "" { |
|
|
|
if config.functionCallNameString != "" { |
|
|
|
funcs = funcs.Select(config.functionCallNameString) |
|
|
|
funcs = funcs.Select(config.functionCallNameString) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Append the no action function
|
|
|
|
|
|
|
|
funcs = append(funcs, input.Functions...) |
|
|
|
|
|
|
|
funcs = append(funcs, noActionGrammar) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Update input grammar
|
|
|
|
// Update input grammar
|
|
|
|
jsStruct := funcs.ToJSONStructure() |
|
|
|
jsStruct := funcs.ToJSONStructure() |
|
|
|
config.Grammar = jsStruct.Grammar("") |
|
|
|
config.Grammar = jsStruct.Grammar("") |
|
|
@ -452,7 +452,7 @@ func chatEndpoint(cm *ConfigMerger, o *Option) func(c *fiber.Ctx) error { |
|
|
|
roleFn := "assistant_function_call" |
|
|
|
roleFn := "assistant_function_call" |
|
|
|
r := config.Roles[roleFn] |
|
|
|
r := config.Roles[roleFn] |
|
|
|
if r != "" { |
|
|
|
if r != "" { |
|
|
|
role = roleFn |
|
|
|
role = r |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
r := config.Roles[role] |
|
|
|
r := config.Roles[role] |
|
|
|