mirror of
https://github.com/Jerryplusy/AI-powered-switches.git
synced 2025-07-05 13:49:19 +00:00
修改(报错的是api问题)
This commit is contained in:
parent
51e483c6a1
commit
7cd3ca0f72
@ -1,8 +1,8 @@
|
|||||||
from fastapi import APIRouter, HTTPException
|
from fastapi import APIRouter, HTTPException
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from ...config import settings
|
from src.backend.config import settings
|
||||||
from ..services.ai_service import call_ai_api
|
from src.backend.app.services.ai_service import call_ai_api
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from fastapi import APIRouter
|
from fastapi import APIRouter
|
||||||
from .command_parser import router as command_router
|
from src.backend.app.api.command_parser import router as command_router
|
||||||
from .network_config import router as config_router
|
from src.backend.app.api.network_config import router as config_router
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
router.include_router(command_router, prefix="/parse_command", tags=["Command Parsing"])
|
router.include_router(command_router, prefix="/parse_command", tags=["Command Parsing"])
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
from fastapi.middleware.cors import CORSMiddleware
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
from .api import router as api_router
|
from src.backend.app.api.command_parser import router as api_router
|
||||||
from .config import settings
|
from src.backend.config import settings
|
||||||
|
|
||||||
app = FastAPI(title=settings.app_name)
|
app = FastAPI(title=settings.app_name)
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import aiohttp
|
import aiohttp
|
||||||
import logging
|
import logging
|
||||||
from typing import Dict, Any
|
from typing import Dict, Any
|
||||||
from ...config import settings
|
from src.backend.config import settings
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -56,4 +56,4 @@ async def call_ai_api(command: str, device_type: str, vendor: str, api_key: str)
|
|||||||
return {
|
return {
|
||||||
"success": False,
|
"success": False,
|
||||||
"message": f"Error calling AI API: {str(e)}"
|
"message": f"Error calling AI API: {str(e)}"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user