mirror of
https://github.com/mudler/LocalAI.git
synced 2025-01-12 07:52:54 +00:00
Fixup custom role encoding
Signed-off-by: mudler <mudler@localai.io>
This commit is contained in:
parent
e70322676c
commit
dcf35dd25f
@ -459,13 +459,13 @@ func chatEndpoint(cm *ConfigMerger, o *Option) func(c *fiber.Ctx) error {
|
|||||||
for _, i := range input.Messages {
|
for _, i := range input.Messages {
|
||||||
var content string
|
var content string
|
||||||
role := i.Role
|
role := i.Role
|
||||||
// if function call, we want to customize the role so we can display better that the "assistant called a json action"
|
// if function call, we might want to customize the role so we can display better that the "assistant called a json action"
|
||||||
// if an "assistant_function_call" role is defined, we use it, otherwise we use the role that is passed by in the request
|
// if an "assistant_function_call" role is defined, we use it, otherwise we use the role that is passed by in the request
|
||||||
if i.FunctionCall != nil {
|
if i.FunctionCall != nil && i.Role == "assistant" {
|
||||||
roleFn := "assistant_function_call"
|
roleFn := "assistant_function_call"
|
||||||
r := config.Roles[roleFn]
|
r := config.Roles[roleFn]
|
||||||
if r != "" {
|
if r != "" {
|
||||||
role = r
|
role = roleFn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
r := config.Roles[role]
|
r := config.Roles[role]
|
||||||
|
Loading…
Reference in New Issue
Block a user