@@ -11,7 +11,6 @@ import (
1111 "sync"
1212
1313 "github.com/mudler/LocalAGI/pkg/config"
14- "github.com/mudler/LocalAGI/pkg/localoperator"
1514 "github.com/mudler/LocalAGI/pkg/xstrings"
1615 "github.com/mudler/LocalAGI/services/actions"
1716 "github.com/mudler/xlog"
@@ -153,34 +152,34 @@ func replaceUserIDsWithNamesInMessage(api *slack.Client, message string) string
153152func generateAttachmentsFromJobResponse (j * types.JobResult , api * slack.Client , channelID , ts string ) (attachments []slack.Attachment ) {
154153 for _ , state := range j .State {
155154 // coming from the browser agent
156- if history , exists := state .Metadata [actions .MetadataBrowserAgentHistory ]; exists {
157- if historyStruct , ok := history .(* localoperator.StateHistory ); ok {
158- state := historyStruct .States [len (historyStruct .States )- 1 ]
159- // Decode base64 screenshot and upload to Slack
160- if state .Screenshot != "" {
161- screenshotData , err := base64 .StdEncoding .DecodeString (state .Screenshot )
162- if err != nil {
163- xlog .Error (fmt .Sprintf ("Error decoding screenshot: %v" , err ))
164- continue
165- }
166-
167- data := string (screenshotData )
168- // Upload the file to Slack
169- _ , err = api .UploadFileV2 (slack.UploadFileV2Parameters {
170- Reader : bytes .NewReader (screenshotData ),
171- FileSize : len (data ),
172- ThreadTimestamp : ts ,
173- Channel : channelID ,
174- Filename : "screenshot.png" ,
175- InitialComment : "Browser Agent Screenshot" ,
176- })
177- if err != nil {
178- xlog .Error (fmt .Sprintf ("Error uploading screenshot: %v" , err ))
179- continue
180- }
181- }
182- }
183- }
155+ // if history, exists := state.Metadata[actions.MetadataBrowserAgentHistory]; exists {
156+ // if historyStruct, ok := history.(*localoperator.StateHistory); ok {
157+ // state := historyStruct.States[len(historyStruct.States)-1]
158+ // // Decode base64 screenshot and upload to Slack
159+ // if state.Screenshot != "" {
160+ // screenshotData, err := base64.StdEncoding.DecodeString(state.Screenshot)
161+ // if err != nil {
162+ // xlog.Error(fmt.Sprintf("Error decoding screenshot: %v", err))
163+ // continue
164+ // }
165+
166+ // data := string(screenshotData)
167+ // // Upload the file to Slack
168+ // _, err = api.UploadFileV2(slack.UploadFileV2Parameters{
169+ // Reader: bytes.NewReader(screenshotData),
170+ // FileSize: len(data),
171+ // ThreadTimestamp: ts,
172+ // Channel: channelID,
173+ // Filename: "screenshot.png",
174+ // InitialComment: "Browser Agent Screenshot",
175+ // })
176+ // if err != nil {
177+ // xlog.Error(fmt.Sprintf("Error uploading screenshot: %v", err))
178+ // continue
179+ // }
180+ // }
181+ // }
182+ // }
184183
185184 // coming from the search action
186185 if urls , exists := state .Metadata [actions .MetadataUrls ]; exists {
@@ -219,11 +218,11 @@ func generateAttachmentsFromJobResponse(j *types.JobResult, api *slack.Client, c
219218 filename = "audio"
220219 }
221220 _ , err = api .UploadFileV2 (slack.UploadFileV2Parameters {
222- Reader : bytes .NewReader (data ),
223- FileSize : len (data ),
221+ Reader : bytes .NewReader (data ),
222+ FileSize : len (data ),
224223 ThreadTimestamp : ts ,
225- Channel : channelID ,
226- Filename : filename ,
224+ Channel : channelID ,
225+ Filename : filename ,
227226 InitialComment : "Generated song" ,
228227 })
229228 if err != nil {
0 commit comments