1
0
mirror of https://github.com/coalaura/whiskr.git synced 2025-12-02 20:22:52 +00:00

image generation wip

This commit is contained in:
Laura
2025-09-11 23:25:58 +02:00
parent 27dbd0e642
commit 1c4ff26378
10 changed files with 105 additions and 24 deletions

View File

@@ -52,6 +52,19 @@ func (s *Stream) Send(ch Chunk) error {
return WriteChunk(s.wr, s.ctx, ch)
}
func StartChunk() Chunk {
return Chunk{
Type: "start",
}
}
func IDChunk(id string) Chunk {
return Chunk{
Type: "id",
Text: id,
}
}
func ReasoningChunk(text string) Chunk {
return Chunk{
Type: "reason",
@@ -73,10 +86,10 @@ func ToolChunk(tool *ToolCall) Chunk {
}
}
func IDChunk(id string) Chunk {
func ErrorChunk(err error) Chunk {
return Chunk{
Type: "id",
Text: id,
Type: "error",
Text: GetErrorMessage(err),
}
}
@@ -86,19 +99,6 @@ func EndChunk() Chunk {
}
}
func StartChunk() Chunk {
return Chunk{
Type: "start",
}
}
func ErrorChunk(err error) Chunk {
return Chunk{
Type: "error",
Text: GetErrorMessage(err),
}
}
func GetErrorMessage(err error) string {
if apiErr, ok := err.(*openrouter.APIError); ok {
return apiErr.Error()