36 lines
811 B
Python
36 lines
811 B
Python
|
|
#!/usr/bin/env python
|
||
|
|
# -*- encoding:utf-8 -*-
|
||
|
|
|
||
|
|
import fastapi.staticfiles
|
||
|
|
import uvicorn.config
|
||
|
|
from http import HTTPStatus
|
||
|
|
import fastapi
|
||
|
|
import logging
|
||
|
|
import config
|
||
|
|
|
||
|
|
app = fastapi.FastAPI()
|
||
|
|
|
||
|
|
app.mount("/output", fastapi.staticfiles.StaticFiles(directory="output"), name="output")
|
||
|
|
|
||
|
|
logger = logging.getLogger('sqlcode')
|
||
|
|
|
||
|
|
logger.info('ENVIRONMENT: %s', config.ENVIRONMENT)
|
||
|
|
logger.debug('LOG DEBUG : ON')
|
||
|
|
|
||
|
|
@app.get('/health', include_in_schema=False)
|
||
|
|
def health():
|
||
|
|
return fastapi.Response('OK', HTTPStatus.OK)
|
||
|
|
|
||
|
|
from query import app as query_app
|
||
|
|
app.mount('/query', query_app)
|
||
|
|
|
||
|
|
from wechat import app as wechat_app
|
||
|
|
app.mount('/wechat', wechat_app)
|
||
|
|
|
||
|
|
from tgi_app import app as tgi_app
|
||
|
|
app.mount('/tgi', tgi_app)
|
||
|
|
|
||
|
|
if __name__ == '__main__':
|
||
|
|
import uvicorn
|
||
|
|
uvicorn.run(app, host='0.0.0.0', port=8000)
|