MCPcopy Index your code
hub / github.com/PromtEngineer/localGPT / send_json_response

Method send_json_response

rag_system/api_server.py:734–741  ·  view source on GitHub ↗

Utility to send a JSON response with CORS headers.

(self, data, status_code=200)

Source from the content-addressed store, hash-verified

732 self.send_json_response({"error": f"Could not list models: {e}"}, status_code=500)
733
734 def send_json_response(self, data, status_code=200):
735 """Utility to send a JSON response with CORS headers."""
736 self.send_response(status_code)
737 self.send_header('Content-Type', 'application/json')
738 self.send_header('Access-Control-Allow-Origin', '*')
739 self.end_headers()
740 response = json.dumps(data, indent=2)
741 self.wfile.write(response.encode('utf-8'))
742
743def start_server(port=8001):
744 """Starts the API server."""

Callers 6

do_POSTMethod · 0.95
do_GETMethod · 0.95
handle_chatMethod · 0.95
handle_chat_streamMethod · 0.95
handle_indexMethod · 0.95
handle_modelsMethod · 0.95

Calls 1

encodeMethod · 0.80

Tested by

no test coverage detected