mirror of
https://github.com/danielmiessler/fabric
synced 2024-11-08 07:11:06 +00:00
feat: implement print session and context
This commit is contained in:
parent
9452d6bd2a
commit
c685b4f810
@ -24,7 +24,7 @@ func (o *Sessions) PrintSession(name string) (err error) {
|
|||||||
if o.Exists(name) {
|
if o.Exists(name) {
|
||||||
var session Session
|
var session Session
|
||||||
if err = o.LoadAsJson(name, &session.Messages); err == nil {
|
if err = o.LoadAsJson(name, &session.Messages); err == nil {
|
||||||
fmt.Println(session)
|
fmt.Println(session.String())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
@ -56,7 +56,7 @@ func (o *Session) GetLastMessage() (ret *common.Message) {
|
|||||||
|
|
||||||
func (o *Session) String() (ret string) {
|
func (o *Session) String() (ret string) {
|
||||||
for _, message := range o.Messages {
|
for _, message := range o.Messages {
|
||||||
ret += fmt.Sprintf("[%v] >\n\n%v\n\n", message.Role, message.Content)
|
ret += fmt.Sprintf("\n\n\n[%v]>> \n\n\n%v", message.Role, message.Content)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user