添加 docker 镜像打包部署脚本 (#27)
* 删除env * 修改生产依赖安装缺失。 * 添加docker镜像构建 * no message * 修改超时时间。 * 修复镜像构建错误。 * 修改环境变量获取baseapi * 修改前端链接获取位置。 * 删除默认env * 添加会 .env 文件,但是注释掉。 * 使用默认 api。 * 添加前端调试和部署路由兼容。 * 删除key * Update .env * Delete build_docker.yml 暂时不做 `git hooks` 处理 * Delete .gitignore * Delete Dockerfile 工作路径好像有点错误,先不合并 * Delete build.sh 工作路径好像有点错误,先不合并 --------- Co-authored-by: 王金海(haha.wang) <wanghaha@huolala.cn> Co-authored-by: haha.wang <haha.wang@huolala.cn> Co-authored-by: Redon <790348264@qq.com>
This commit is contained in:
@@ -3,7 +3,9 @@ import type { ChatContext } from './chatgpt'
|
||||
import { chatReply } from './chatgpt'
|
||||
|
||||
const app = express()
|
||||
const router = express.Router()
|
||||
|
||||
app.use(express.static('public'))
|
||||
app.use(express.json())
|
||||
|
||||
app.all('*', (_, res, next) => {
|
||||
@@ -13,7 +15,7 @@ app.all('*', (_, res, next) => {
|
||||
next()
|
||||
})
|
||||
|
||||
app.post('/chat', async (req, res) => {
|
||||
router.post('/chat', async (req, res) => {
|
||||
try {
|
||||
const { prompt, options = {} } = req.body as { prompt: string; options?: ChatContext }
|
||||
const response = await chatReply(prompt, options)
|
||||
@@ -24,4 +26,7 @@ app.post('/chat', async (req, res) => {
|
||||
}
|
||||
})
|
||||
|
||||
app.use('', router)
|
||||
app.use('/api', router)
|
||||
|
||||
app.listen(3002, () => globalThis.console.log('Server is running on port 3002'))
|
||||
|
||||
Reference in New Issue
Block a user