chore: refactoring

This commit is contained in:
adamdottv
2025-05-13 11:07:34 -05:00
parent 1f9610e266
commit 674797bd48
5 changed files with 31 additions and 34 deletions

View File

@@ -106,21 +106,11 @@ func (ToolResult) isPart() {}
type Finish struct {
Reason FinishReason `json:"reason"`
Time int64 `json:"time"`
Time time.Time `json:"time"`
}
func (Finish) isPart() {}
type Message struct {
ID string
Role MessageRole
SessionID string
Parts []ContentPart
Model models.ModelID
CreatedAt int64
UpdatedAt int64
}
func (m *Message) Content() *TextContent {
for _, part := range m.Parts {
if c, ok := part.(TextContent); ok {
@@ -318,7 +308,7 @@ func (m *Message) AddFinish(reason FinishReason) {
break
}
}
m.Parts = append(m.Parts, Finish{Reason: reason, Time: time.Now().UnixMilli()})
m.Parts = append(m.Parts, Finish{Reason: reason, Time: time.Now()})
}
func (m *Message) AddImageURL(url, detail string) {