mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-15 00:36:56 +08:00
change v1
This commit is contained in:
@@ -8,6 +8,8 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const maxPersistentPreferenceLength = 500
|
||||
|
||||
// PersistentPreference is a durable user instruction shown in the UI and
|
||||
// injected into the agent context for future conversations.
|
||||
type PersistentPreference struct {
|
||||
@@ -21,6 +23,9 @@ func NewPersistentPreference(text string) (PersistentPreference, error) {
|
||||
if text == "" {
|
||||
return PersistentPreference{}, fmt.Errorf("text required")
|
||||
}
|
||||
if len([]rune(text)) > maxPersistentPreferenceLength {
|
||||
return PersistentPreference{}, fmt.Errorf("text too long (max %d characters)", maxPersistentPreferenceLength)
|
||||
}
|
||||
|
||||
now := time.Now().UTC()
|
||||
return PersistentPreference{
|
||||
|
||||
Reference in New Issue
Block a user