feat(quill): assistant crow Quill — addressable service role with persona reply (#38)
This commit is contained in:
1 parent
abb8453db2
commit
9744904645
4 files changed
+61
-12
No files matched your search
@@ -0,0 +1,35 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
const quillSystem = `You are Quill crow, the owner's assistant and point of contact in a nest of AI crows.
|
||||
Answer the owner in one or two plain sentences. You are text-only: no web, no files, no tools.`
|
||||
|
||||
// respondQuill answers a message addressed to Quill, the assistant service
|
||||
// role (CHATROOM_SPEC section 6). D1: one in-character reply through the
|
||||
// flock. Reading the nest for status (D2) and relaying (D3) extend this file.
|
||||
func (s *Server) respondQuill(nest Nest, req Message) {
|
||||
budget := &Budget{name: "quill-reply", limit: s.p.G.TokenBudgetPerItem}
|
||||
system := systemFor("Quill", quillSystem, false)
|
||||
prompt := "FROM: " + req.Author + "\nMESSAGE: " + req.Text
|
||||
answer, err := s.p.Flock.ask(s.ctx, nil, "Quill", system, prompt, budget)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
reply := Message{
|
||||
NestID: nest.ID,
|
||||
Kind: "deliver",
|
||||
Author: "Quill",
|
||||
Text: strings.TrimSpace(answer),
|
||||
To: req.Author,
|
||||
RefersTo: req.MsgID(),
|
||||
TaggedBy: "harness",
|
||||
Timestamp: time.Now().UTC().Format(time.RFC3339),
|
||||
}
|
||||
if record, err := s.msgs.Append(reply); err == nil {
|
||||
s.emitNestMessage(record)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user