mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-27 20:39:41 +00:00
WEB API independent
This commit is contained in:
parent
35bdf71912
commit
865822d1de
@ -2,7 +2,10 @@
|
|||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
experimental: {
|
experimental: {
|
||||||
esmExternals: 'loose'
|
esmExternals: 'loose'
|
||||||
}
|
},
|
||||||
|
images: {
|
||||||
|
unoptimized: true
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = nextConfig
|
module.exports = nextConfig
|
||||||
|
@ -6,7 +6,9 @@
|
|||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "next lint"
|
"lint": "next lint",
|
||||||
|
"export": "next export",
|
||||||
|
"compile": "next build && next export"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ant-design/pro-components": "^2.6.2",
|
"@ant-design/pro-components": "^2.6.2",
|
||||||
|
@ -2,7 +2,7 @@ import { message } from 'antd';
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { isPlainObject } from 'lodash';
|
import { isPlainObject } from 'lodash';
|
||||||
|
|
||||||
axios.defaults.baseURL = 'http://30.183.154.8:5000';
|
axios.defaults.baseURL = 'http://localhost:5000';
|
||||||
|
|
||||||
axios.defaults.timeout = 10000;
|
axios.defaults.timeout = 10000;
|
||||||
|
|
||||||
|
Binary file not shown.
@ -2,13 +2,13 @@ import uuid
|
|||||||
import json
|
import json
|
||||||
import asyncio
|
import asyncio
|
||||||
import time
|
import time
|
||||||
|
import os
|
||||||
from fastapi import APIRouter, Request, Body, status, HTTPException, Response, BackgroundTasks
|
from fastapi import APIRouter, Request, Body, status, HTTPException, Response, BackgroundTasks
|
||||||
|
|
||||||
from fastapi.responses import JSONResponse
|
from fastapi.responses import JSONResponse, HTMLResponse
|
||||||
from fastapi.responses import StreamingResponse
|
from fastapi.responses import StreamingResponse, FileResponse
|
||||||
from fastapi.encoders import jsonable_encoder
|
from fastapi.encoders import jsonable_encoder
|
||||||
from fastapi.exceptions import RequestValidationError
|
from fastapi.exceptions import RequestValidationError
|
||||||
from fastapi.responses import JSONResponse
|
|
||||||
from sse_starlette.sse import EventSourceResponse
|
from sse_starlette.sse import EventSourceResponse
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ knowledge_service = KnowledgeService()
|
|||||||
|
|
||||||
model_semaphore = None
|
model_semaphore = None
|
||||||
global_counter = 0
|
global_counter = 0
|
||||||
|
static_file_path = os.path.join(os.getcwd(), "server/static")
|
||||||
|
|
||||||
async def validation_exception_handler(request: Request, exc: RequestValidationError):
|
async def validation_exception_handler(request: Request, exc: RequestValidationError):
|
||||||
message = ""
|
message = ""
|
||||||
@ -82,6 +82,9 @@ def knowledge_list():
|
|||||||
params.update({space.name: space.name})
|
params.update({space.name: space.name})
|
||||||
return params
|
return params
|
||||||
|
|
||||||
|
@router.get("/")
|
||||||
|
async def read_main():
|
||||||
|
return FileResponse(f"{static_file_path}/test.html")
|
||||||
|
|
||||||
|
|
||||||
@router.get("/v1/chat/dialogue/list", response_model=Result[ConversationVo])
|
@router.get("/v1/chat/dialogue/list", response_model=Result[ConversationVo])
|
||||||
|
@ -55,7 +55,6 @@ app.add_middleware(
|
|||||||
)
|
)
|
||||||
|
|
||||||
app.mount("/static", StaticFiles(directory=static_file_path), name="static")
|
app.mount("/static", StaticFiles(directory=static_file_path), name="static")
|
||||||
app.add_route("/test", "static/test.html")
|
|
||||||
|
|
||||||
app.include_router(api_v1)
|
app.include_router(api_v1)
|
||||||
app.add_exception_handler(RequestValidationError, validation_exception_handler)
|
app.add_exception_handler(RequestValidationError, validation_exception_handler)
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="output"></div>
|
<div id="output">Hello World! I'm DB-GPT!</div>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var source = new EventSource("/v1/chat/completions");
|
var source = new EventSource("/v1/chat/completions");
|
||||||
|
Loading…
Reference in New Issue
Block a user