Feat: read img tool for chat endpoint

This commit is contained in:
Grail Finder
2026-03-02 07:12:28 +03:00
parent 742f1ca838
commit caac1d397a
4 changed files with 113 additions and 11 deletions

View File

@@ -391,7 +391,6 @@ func CreateImageURLFromPath(imagePath string) (string, error) {
if err != nil {
return "", err
}
// Determine the image format based on file extension
var mimeType string
switch {
@@ -408,10 +407,8 @@ func CreateImageURLFromPath(imagePath string) (string, error) {
default:
mimeType = "image/jpeg" // default
}
// Encode to base64
encoded := base64.StdEncoding.EncodeToString(data)
// Create data URL
return fmt.Sprintf("data:%s;base64,%s", mimeType, encoded), nil
}
@@ -623,3 +620,8 @@ type ChatRoundReq struct {
Regen bool
Resume bool
}
type MultimodalToolResp struct {
Type string `json:"type"`
Parts []map[string]string `json:"parts"`
}