Spaces:
Runtime error
Runtime error
Update api/common.go
Browse files- api/common.go +2 -1
api/common.go
CHANGED
@@ -117,7 +117,7 @@ func HandleConversationResponse(c *gin.Context, resp *http.Response) (bool, stri
|
|
117 |
var result map[string]interface{}
|
118 |
err := json.Unmarshal([]byte(line[6:]), &result)
|
119 |
if err == nil {
|
120 |
-
|
121 |
content := message["content"].(map[string]interface{})
|
122 |
parts := content["parts"].([]interface{})
|
123 |
part = parts[0].(string)
|
@@ -132,6 +132,7 @@ func HandleConversationResponse(c *gin.Context, resp *http.Response) (bool, stri
|
|
132 |
line = "data: " + string(resultJSON)
|
133 |
// logger.Info(fmt.Sprintf("HandleConversationResponseAddon: %s", line))
|
134 |
}
|
|
|
135 |
}
|
136 |
} else {
|
137 |
|
|
|
117 |
var result map[string]interface{}
|
118 |
err := json.Unmarshal([]byte(line[6:]), &result)
|
119 |
if err == nil {
|
120 |
+
if message, ok := result["message"].(map[string]interface{}); ok {
|
121 |
content := message["content"].(map[string]interface{})
|
122 |
parts := content["parts"].([]interface{})
|
123 |
part = parts[0].(string)
|
|
|
132 |
line = "data: " + string(resultJSON)
|
133 |
// logger.Info(fmt.Sprintf("HandleConversationResponseAddon: %s", line))
|
134 |
}
|
135 |
+
}
|
136 |
}
|
137 |
} else {
|
138 |
|