control show of character,global callbacks, re-add replies during internal runs to self-stop

This commit is contained in:
Ettore Di Giacinto
2024-04-05 01:20:20 +02:00
parent 744af19025
commit 652cef288d
9 changed files with 165 additions and 60 deletions

View File

@@ -13,17 +13,21 @@ type llmOptions struct {
}
type options struct {
LLMAPI llmOptions
character Character
randomIdentityGuidance string
randomIdentity bool
userActions Actions
enableHUD, standaloneJob bool
debugMode bool
characterfile string
statefile string
context context.Context
permanentGoal string
LLMAPI llmOptions
character Character
randomIdentityGuidance string
randomIdentity bool
userActions Actions
enableHUD, standaloneJob, showCharacter bool
debugMode bool
characterfile string
statefile string
context context.Context
permanentGoal string
// callbacks
reasoningCallback func(ActionCurrentState) bool
resultCallback func(ActionState)
}
func defaultOptions() *options {
@@ -69,6 +73,11 @@ var EnableStandaloneJob = func(o *options) error {
return nil
}
var EnableCharacter = func(o *options) error {
o.showCharacter = true
return nil
}
func WithLLMAPIURL(url string) Option {
return func(o *options) error {
o.LLMAPI.APIURL = url
@@ -97,6 +106,20 @@ func WithContext(ctx context.Context) Option {
}
}
func WithAgentReasoningCallback(cb func(ActionCurrentState) bool) Option {
return func(o *options) error {
o.reasoningCallback = cb
return nil
}
}
func WithAgentResultCallback(cb func(ActionState)) Option {
return func(o *options) error {
o.resultCallback = cb
return nil
}
}
func WithModel(model string) Option {
return func(o *options) error {
o.LLMAPI.Model = model