Updated main file
This commit is contained in:
@@ -1,17 +1,59 @@
|
||||
import asyncio
|
||||
from pathlib import Path
|
||||
|
||||
from .llm_engine import LlmEngine
|
||||
from .system_metrics import SystemMetrics
|
||||
from .web_agent import WebAgent
|
||||
from .web_io_buffer import WebIOBuffer
|
||||
from .web_server import WebServer
|
||||
from .working_memory import WorkingMemory
|
||||
from .xml_validator import XMLValidator
|
||||
from .response_parser import ResponseParser
|
||||
|
||||
async def run_web_server():
|
||||
"""Run the web server with default configuration."""
|
||||
# Load system prompt and action schema
|
||||
base_dir = Path(__file__).parent.parent
|
||||
with open(base_dir / "system_prompt.txt", "r") as f:
|
||||
system_prompt = f.read()
|
||||
with open(base_dir / "action_schema.xsd", "r") as f:
|
||||
action_schema = f.read()
|
||||
|
||||
# Initialize core components
|
||||
llm = LlmEngine("/root/model")
|
||||
working_memory = WorkingMemory()
|
||||
system_metrics = SystemMetrics()
|
||||
validator = XMLValidator(action_schema)
|
||||
io_buffer = WebIOBuffer()
|
||||
parser = ResponseParser(io_buffer)
|
||||
|
||||
# Create web agent
|
||||
agent = WebAgent(
|
||||
system_prompt=system_prompt,
|
||||
action_schema=action_schema,
|
||||
working_memory=working_memory,
|
||||
system_metrics=system_metrics,
|
||||
llm=llm,
|
||||
validator=validator,
|
||||
parser=parser
|
||||
)
|
||||
|
||||
# Create and start web server
|
||||
server = WebServer(agent, io_buffer)
|
||||
await server.start()
|
||||
|
||||
try:
|
||||
# Keep running until interrupted
|
||||
while True:
|
||||
await asyncio.sleep(1)
|
||||
except KeyboardInterrupt:
|
||||
print("\nShutting down...")
|
||||
finally:
|
||||
await server.stop()
|
||||
|
||||
def main():
|
||||
"""Main entry point for the SIA application."""
|
||||
system_prompt_path = "system_prompt.txt"
|
||||
action_schema_path = "action_schema.xsd"
|
||||
model_path = "/root/model"
|
||||
|
||||
with open(system_prompt_path, 'r') as f:
|
||||
system_prompt = f.read()
|
||||
with open(action_schema_path, 'r') as f:
|
||||
action_schema = f.read()
|
||||
|
||||
print("todo")
|
||||
asyncio.run(run_web_server())
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user