1
0
mirror of https://github.com/coalaura/whiskr.git synced 2025-12-02 20:22:52 +00:00

transformation methods

This commit is contained in:
Laura
2025-10-03 01:30:40 +02:00
parent ef2af41c9c
commit ae573b1c51
3 changed files with 11 additions and 0 deletions

View File

@@ -116,6 +116,8 @@ func (r *Request) Parse() (*openrouter.ChatCompletionRequest, int, error) {
request.Modalities = append(request.Modalities, openrouter.ModalityImage)
}
request.Transforms = append(request.Transforms, env.Settings.Transformation)
if r.Iterations < 1 || r.Iterations > 50 {
return nil, 0, fmt.Errorf("invalid iterations (1-50): %d", r.Iterations)
}

7
env.go
View File

@@ -22,6 +22,7 @@ type EnvSettings struct {
CleanContent bool `json:"cleanup"`
TitleModel string `json:"title-model"`
ImageGeneration bool `json:"image-generation"`
Transformation string `json:"transformation"`
}
type EnvUI struct {
@@ -118,6 +119,11 @@ func (e *Environment) Init() error {
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
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.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.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)")},

View File

@@ -18,6 +18,8 @@ settings:
title-model: google/gemini-2.5-flash-lite
# allow image generation (optional; default: true)
image-generation: true
# what transformation method to use for too long contexts (optional; default: middle-out)
transformation: "middle-out"
ui:
# disables things like the floating stars in the background (optional; default: false)