mirror of
https://github.com/coalaura/whiskr.git
synced 2025-12-02 20:22:52 +00:00
transformation methods
This commit is contained in:
2
chat.go
2
chat.go
@@ -116,6 +116,8 @@ func (r *Request) Parse() (*openrouter.ChatCompletionRequest, int, error) {
|
|||||||
request.Modalities = append(request.Modalities, openrouter.ModalityImage)
|
request.Modalities = append(request.Modalities, openrouter.ModalityImage)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
request.Transforms = append(request.Transforms, env.Settings.Transformation)
|
||||||
|
|
||||||
if r.Iterations < 1 || r.Iterations > 50 {
|
if r.Iterations < 1 || r.Iterations > 50 {
|
||||||
return nil, 0, fmt.Errorf("invalid iterations (1-50): %d", r.Iterations)
|
return nil, 0, fmt.Errorf("invalid iterations (1-50): %d", r.Iterations)
|
||||||
}
|
}
|
||||||
|
|||||||
7
env.go
7
env.go
@@ -22,6 +22,7 @@ type EnvSettings struct {
|
|||||||
CleanContent bool `json:"cleanup"`
|
CleanContent bool `json:"cleanup"`
|
||||||
TitleModel string `json:"title-model"`
|
TitleModel string `json:"title-model"`
|
||||||
ImageGeneration bool `json:"image-generation"`
|
ImageGeneration bool `json:"image-generation"`
|
||||||
|
Transformation string `json:"transformation"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type EnvUI struct {
|
type EnvUI struct {
|
||||||
@@ -118,6 +119,11 @@ func (e *Environment) Init() error {
|
|||||||
e.Settings.TitleModel = "google/gemini-2.5-flash-lite"
|
e.Settings.TitleModel = "google/gemini-2.5-flash-lite"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// default transformation method
|
||||||
|
if e.Settings.Transformation == "" {
|
||||||
|
e.Settings.Transformation = "middle-out"
|
||||||
|
}
|
||||||
|
|
||||||
// create user lookup map
|
// create user lookup map
|
||||||
e.Authentication.lookup = make(map[string]*EnvUser)
|
e.Authentication.lookup = make(map[string]*EnvUser)
|
||||||
|
|
||||||
@@ -169,6 +175,7 @@ func (e *Environment) Store() error {
|
|||||||
"$.settings.cleanup": {yaml.HeadComment(" normalize unicode in assistant output (optional; default: true)")},
|
"$.settings.cleanup": {yaml.HeadComment(" normalize unicode in assistant output (optional; default: true)")},
|
||||||
"$.settings.title-model": {yaml.HeadComment(" model used to generate titles (needs to have structured output support; default: google/gemini-2.5-flash-lite)")},
|
"$.settings.title-model": {yaml.HeadComment(" model used to generate titles (needs to have structured output support; default: google/gemini-2.5-flash-lite)")},
|
||||||
"$.settings.image-generation": {yaml.HeadComment(" allow image generation (optional; default: true)")},
|
"$.settings.image-generation": {yaml.HeadComment(" allow image generation (optional; default: true)")},
|
||||||
|
"$.settings.transformation": {yaml.HeadComment(" what transformation method to use for too long contexts (optional; default: middle-out)")},
|
||||||
|
|
||||||
"$.ui.reduced-motion": {yaml.HeadComment(" disables things like the floating stars in the background (optional; default: false)")},
|
"$.ui.reduced-motion": {yaml.HeadComment(" disables things like the floating stars in the background (optional; default: false)")},
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ settings:
|
|||||||
title-model: google/gemini-2.5-flash-lite
|
title-model: google/gemini-2.5-flash-lite
|
||||||
# allow image generation (optional; default: true)
|
# allow image generation (optional; default: true)
|
||||||
image-generation: true
|
image-generation: true
|
||||||
|
# what transformation method to use for too long contexts (optional; default: middle-out)
|
||||||
|
transformation: "middle-out"
|
||||||
|
|
||||||
ui:
|
ui:
|
||||||
# disables things like the floating stars in the background (optional; default: false)
|
# disables things like the floating stars in the background (optional; default: false)
|
||||||
|
|||||||
Reference in New Issue
Block a user