-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
38 lines (30 loc) · 1.17 KB
/
main.py
File metadata and controls
38 lines (30 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import os
import sys
import logging
from api import app
from config import PORT, DEBUG, OLLAMA_HOST
import logging_utils
from ollama_client import OllamaClient
# Configure logging
logger = logging_utils.get_logger(__name__)
def check_ollama_service():
"""Check if Ollama service is running and accessible"""
client = OllamaClient(host="http://localhost:11434")
if not client.is_server_running():
logger.error(f"Cannot connect to Ollama at {client.host}")
logger.error("Please make sure Ollama is installed and running")
logger.error("Download Ollama from https://ollama.com/download")
logger.error("Or run python check_model.py for detailed diagnostics")
return False
logger.info(f"Connected to Ollama at {client.host}")
return True
def main():
"""Main entry point for the application"""
logger.info(f"Starting mem0-Ollama server on port {PORT}")
logger.info(f"Access web interface at http://localhost:{PORT}/")
# Check Ollama service status
check_ollama_service()
# Start the Flask application
app.run(host='0.0.0.0', port=PORT, debug=DEBUG)
if __name__ == "__main__":
main()