AnP/Python/run.py

38 lines
1.1 KiB
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import Any
from Application.AnP import AnP
from Controllers.AIController import AIController
from Drivers.WebSocketServerDriver import WebSocketServerDriver
from Drivers.HTTPSocketServerDriver import HTTPSocketServerDriver
from Drivers.HTTPServerDriver import HTTPServerDriver
from Drivers.OllamaDriver import OllamaDriver
from Drivers.FilesDriver import FilesDriver
inputs:dict[str, dict[str, Any|None]] = {
"default_models" : {
"AIController" : AIController,
"WebSocketServerDriver" : WebSocketServerDriver,
"HTTPSocketServerDriver" : HTTPSocketServerDriver,
"HTTPServerDriver" : HTTPServerDriver,
"OllamaDriver" : OllamaDriver,
"FilesDriver" : FilesDriver
}
}
try:
from secrets import secrets as custom_secrets
for key, value in dict(custom_secrets).items():
if key not in inputs or isinstance(inputs[key], dict):
inputs[key] = value
elif isinstance(value, dict):
for subkey, subvalue in value.items():
inputs[key][subkey] = subvalue
except ImportError:
pass
anp:AnP = AnP(inputs)