extractJSONArray extracts JSON array from AI response
(response string)
| 514 | |
| 515 | // extractJSONArray extracts JSON array from AI response |
| 516 | func extractJSONArray(response string) string { |
| 517 | // Try to find ```json code block first |
| 518 | matches := reJSONFence.FindStringSubmatch(response) |
| 519 | if len(matches) > 1 { |
| 520 | return matches[1] |
| 521 | } |
| 522 | |
| 523 | // Try to find raw JSON array |
| 524 | matches = reJSONArray.FindStringSubmatch(response) |
| 525 | if len(matches) > 0 { |
| 526 | return matches[0] |
| 527 | } |
| 528 | |
| 529 | return "" |
| 530 | } |
| 531 | |
| 532 | // isValidGridAction checks if action is a valid grid action |
| 533 | func isValidGridAction(action string) bool { |
no outgoing calls
no test coverage detected