Skip to content

Commit b3f43ab

Browse files
committed
Add a way to disable default action
1 parent bbc4468 commit b3f43ab

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

api/config.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ type Config struct {
4242
MainGPU string `yaml:"main_gpu"`
4343
ImageGenerationAssets string `yaml:"asset_dir"`
4444

45+
DisableDefaultAnswer bool `yaml:"disable_default_answer"`
46+
4547
PromptCachePath string `yaml:"prompt_cache_path"`
4648
PromptCacheAll bool `yaml:"prompt_cache_all"`
4749
PromptCacheRO bool `yaml:"prompt_cache_ro"`
@@ -269,7 +271,6 @@ func updateConfig(config *Config, input *OpenAIRequest) {
269271
}
270272
}
271273
}
272-
273274
// Can be either a string or an object
274275
switch fnc := input.FunctionCall.(type) {
275276
case string:

api/openai.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,9 @@ func chatEndpoint(cm *ConfigMerger, o *Option) func(c *fiber.Ctx) error {
425425

426426
// Append the no action function
427427
funcs = append(funcs, input.Functions...)
428-
funcs = append(funcs, noActionGrammar)
428+
if !config.DisableDefaultAnswer {
429+
funcs = append(funcs, noActionGrammar)
430+
}
429431

430432
// Force picking one of the functions by the request
431433
if config.functionCallNameString != "" {

0 commit comments

Comments
 (0)