feat(api): implement stateful responses api (#122)

* feat(api): implement stateful responses api

Signed-off-by: mudler <mudler@localai.io>

* fix(tests): align client to API changes

Signed-off-by: mudler <mudler@localai.io>

---------

Signed-off-by: mudler <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto
2025-04-01 18:00:37 +02:00
committed by GitHub
parent 86cb9f1282
commit f3c06b1bfb
6 changed files with 68 additions and 16 deletions

View File

@@ -1,15 +1,20 @@
package webui
import "github.com/mudler/LocalAgent/core/state"
import (
"time"
"github.com/mudler/LocalAgent/core/state"
)
type Config struct {
DefaultChunkSize int
Pool *state.AgentPool
ApiKeys []string
LLMAPIURL string
LLMAPIKey string
LLMModel string
StateDir string
DefaultChunkSize int
Pool *state.AgentPool
ApiKeys []string
LLMAPIURL string
LLMAPIKey string
LLMModel string
StateDir string
ConversationStoreDuration time.Duration
}
type Option func(*Config)
@@ -20,6 +25,16 @@ func WithDefaultChunkSize(size int) Option {
}
}
func WithConversationStoreduration(duration string) Option {
return func(c *Config) {
d, err := time.ParseDuration(duration)
if err != nil {
d = 1 * time.Hour
}
c.ConversationStoreDuration = d
}
}
func WithStateDir(dir string) Option {
return func(c *Config) {
c.StateDir = dir