File tree Expand file tree Collapse file tree 4 files changed +58
-4
lines changed Expand file tree Collapse file tree 4 files changed +58
-4
lines changed Original file line number Diff line number Diff line change 1+ FROM python:3.12-slim
2+
3+ WORKDIR /app
4+
5+ RUN apt-get update && apt-get install -y
6+
7+ RUN pip install poetry
8+
9+ COPY pyproject.toml ./
10+
11+ COPY . .
12+
13+ # Configure poetry to not create virtual environment
14+ RUN poetry config virtualenvs.create false
15+
16+ # Install dependencies
17+ RUN poetry install --no-interaction --no-ansi
18+
19+ # Expose port 80
20+ EXPOSE 80
21+
22+ CMD poetry run python -m src.services
Original file line number Diff line number Diff line change @@ -10,13 +10,15 @@ packages = [{include = "src"}]
1010
1111[tool .poetry .dependencies ]
1212python = " >=3.10,<4.0"
13- restack-ai = " ^0.0.48 "
13+ restack-ai = " ^0.0.52 "
1414google-generativeai = " 0.8.3"
15+ watchfiles = " ^1.0.0"
1516
1617[build-system ]
1718requires = [" poetry-core" ]
1819build-backend = " poetry.core.masonry.api"
1920
2021[tool .poetry .scripts ]
22+ dev = " src.services:watch_services"
2123services = " src.services:run_services"
2224schedule = " schedule_workflow:run_schedule_workflow"
Original file line number Diff line number Diff line change 1+ import os
12from restack_ai import Restack
3+ from restack_ai .restack import CloudConnectionOptions
4+ from dotenv import load_dotenv
5+ # Load environment variables from a .env file
6+ load_dotenv ()
27
3- client = Restack ()
8+
9+ engine_id = os .getenv ("RESTACK_ENGINE_ID" )
10+ address = os .getenv ("RESTACK_ENGINE_ADDRESS" )
11+ api_key = os .getenv ("RESTACK_ENGINE_API_KEY" )
12+ api_address = os .getenv ("RESTACK_ENGINE_API_ADDRESS" )
13+
14+ connection_options = CloudConnectionOptions (
15+ engine_id = engine_id ,
16+ address = address ,
17+ api_key = api_key ,
18+ api_address = api_address
19+ )
20+ client = Restack (connection_options )
Original file line number Diff line number Diff line change 11import asyncio
2+ from watchfiles import run_process
3+ import webbrowser
4+ import os
5+
26from src .client import client
37from src .functions .function import gemini_generate_opposite
48from src .workflows .gemini_generate_content import GeminiGenerateOppositeWorkflow
@@ -9,7 +13,16 @@ async def main():
913 )
1014
1115def run_services ():
12- asyncio .run (main ())
16+ try :
17+ asyncio .run (main ())
18+ except KeyboardInterrupt :
19+ print ("Service interrupted by user. Exiting gracefully." )
20+
21+ def watch_services ():
22+ watch_path = os .getcwd ()
23+ print (f"Watching { watch_path } and its subdirectories for changes..." )
24+ webbrowser .open ("http://localhost:5233" )
25+ run_process (watch_path , recursive = True , target = run_services )
1326
1427if __name__ == "__main__" :
15- run_services ()
28+ run_services ()
You can’t perform that action at this time.
0 commit comments