MCPcopy Create free account
hub / github.com/NoFxAiOS/nofx / extractJSONArray

Function extractJSONArray

kernel/grid_engine.go:516–530  ·  view source on GitHub ↗

extractJSONArray extracts JSON array from AI response

(response string)

Source from the content-addressed store, hash-verified

514
515// extractJSONArray extracts JSON array from AI response
516func 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
533func isValidGridAction(action string) bool {

Callers 1

parseGridDecisionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected