Starts the API server.
(port=8001)
| 741 | self.wfile.write(response.encode('utf-8')) |
| 742 | |
| 743 | def start_server(port=8001): |
| 744 | """Starts the API server.""" |
| 745 | # Use a reusable TCP server to avoid "address in use" errors on restart |
| 746 | class ReusableTCPServer(socketserver.TCPServer): |
| 747 | allow_reuse_address = True |
| 748 | |
| 749 | with ReusableTCPServer(("", port), AdvancedRagApiHandler) as httpd: |
| 750 | print(f"🚀 Starting Advanced RAG API server on port {port}") |
| 751 | print(f"💬 Chat endpoint: http://localhost:{port}/chat") |
| 752 | print(f"✨ Indexing endpoint: http://localhost:{port}/index") |
| 753 | httpd.serve_forever() |
| 754 | |
| 755 | if __name__ == "__main__": |
| 756 | # To run this server: python -m rag_system.api_server |
no test coverage detected