编译添加配置文件

This commit is contained in:
Sake 2026-01-27 16:01:25 +08:00
parent 49e6735cf0
commit a7690d7542
7 changed files with 133 additions and 6 deletions

View File

@ -172,6 +172,8 @@ pack/linux:
@make build/local GOOS=$(GOOS) GOARCH=$(GOARCH)
$(eval dir := $(BUILD_DIR_ROOT)/linux_amd64)
@cp -r deploy/easyvqd/* $(dir)
@cp -r deploy/lin/ $(dir)/VqdSDK/
@cp -r deploy/conf/* $(dir)/configs/
@mv $(dir)/bin $(dir)/easyvqd
@upx $(dir)/easyvqd
@make zip/linux
@ -185,6 +187,7 @@ pack/windows:
$(eval dir := $(BUILD_DIR_ROOT)/windows_amd64)
@cp -r deploy/easyvqd/* $(dir)
@cp -r deploy/win/ $(dir)/VqdSDK/
@cp -r deploy/conf/* $(dir)/configs/
@cp -r *dll $(dir)
@mv $(dir)/bin $(dir)/easyvqd.exe
@upx $(dir)/easyvqd.exe

124
deploy/conf/config.toml Normal file
View File

@ -0,0 +1,124 @@
[Server]
# 对外提供的服务,建议由 nginx 代理
[Server.HTTP]
# http 端口
Port = 8089
# 请求超时时间
Timeout = '1m0s'
# jwt 秘钥,空串时,每次启动程序将随机赋值
JwtSecret = 'ZsLfiuBfYQOL6UHG1I4hfcea9tRLbM9i'
[Server.HTTP.PProf]
# 是否启用 pprof, 建议设置为 true
Enabled = true
# 访问白名单
AccessIps = ['::1', '127.0.0.1']
[Data]
# 数据库支持 sqlite 和 postgres 两种,使用 sqlite 时 dsn 应当填写文件存储路径
[Data.Database]
Dsn = './configs/data.db'
MaxIdleConns = 1
MaxOpenConns = 1
ConnMaxLifetime = '6h0m0s'
SlowThreshold = '200ms'
[Plugin]
# http 地址
HttpAPI = 'http://127.0.0.1:10000'
# 通信端口
GrpcPort = 50051
# 是否开启
AllDebug = false
[VqdConfig]
# 数据保存天数
SaveDay = 5
# 连续分析帧数(2-64), 默认为10, 最大为 64
FrmNum = 10
# 是否使用深度学习版本, 默认使用深度学习版本
IsDeepLearn = true
[VqdLgtDark]
# 默认 0.4, 取值范围: 0~1, 建议范围: 0.2~0.6
DarkThr = 0.4
# 默认 0.1, 取值范围: 0~1, 建议范围: 0.1~0.5
LgtThr = 0.1
# 默认为0.5, 取值范围: 0~1, 建议范围: 0.1~0.9
LgtDarkAbnNumRatio = 0.5
[VqdBlue]
# 默认为 0.6, 取值范围: 0~1, 建议范围 0.4~0.9
BlueThr = 0.6
# 默认为0.5, 取值范围: 0~1, 建议范围: 0.1~0.9
BlueAbnNumRatio = 0.5
[VqdClarity]
# 默认为0.4, 取值范围: 0~1, 建议范围: 0.3~0.99
ClarityThr = 0.4
# 默认为0.5, 取值范围: 0~1, 建议范围: 0.1~0.9
ClarityAbnNumRatio = 0.5
[VqdShark]
# 默认为 0.2, 取值范围: 0~1, 建议范围: 0.1~0.8
SharkThr = 0.2
# 默认为0.2, 取值范围: 0~1, 建议范围: 0.1~0.6
SharkAbnNumRatio = 0.2
[VqdFreeze]
# 默认 0.4, 取值范围: 0~1, 建议范围: 0.2~0.6
FreezeThr = 0.999
# 默认为0.99, 取值范围: 0.8~1, 建议范围: 0.95~1
FreezeAbnNumRatio = 0.99
[VqdColor]
# 默认为0.18, 取值范围: 0~1, 建议范围: 0.1~0.5
ColorThr = 0.18
# 默认为0.5, 取值范围: 0~1, 建议范围: 0.3~0.9
ColorAbnNumRatio = 0.5
[VqdOcclusion]
# 默认为0.1, 取值范围: 0~1, 建议范围: 0.05~0.5
OcclusionThr = 0.1
# 默认为0.5, 取值范围: 0~1, 建议范围: 0.3~0.9
OcclusionAbnNumRatio = 0.5
[VqdNoise]
# 默认为 0.3, 取值范围: 0~1, 建议范围: 0.2~0.8
NoiseThr = 0.3
# 默认为0.6, 取值范围: 0~1, 建议范围: 0.3~0.9
NoiseAbnNumRatio = 0.6
[VqdContrast]
# 默认为 0.2, 取值范围: 0~1, 建议范围: 0.1~0.3
CtraLowThr = 0.2
# 默认为 0.8, 取值范围: 0~1, 建议范围: 0.7~0.9
CtraHighThr = 0.8
# 默认为0.5, 取值范围: 0~1, 建议范围: 0.3~0.9
CtraAbnNumRatio = 0.5
[VqdMosaic]
# 默认为 0.1 取值范围: 0~1, 建议范围: 0.1~0.9
MosaicThr = 0.1
# 默认为0.5,取值范围: 0~1, 建议范围: 0.3
MosaicAbnNumRatio = 0.5
[VqdFlower]
# 默认为 0.3 取值范围: 0~1, 建议范围: 0.1~0.9
FlowerThr = 0.1
# 默认为0.6, 取值范围: 0~1, 建议范围: 0.3
FlowerAbnNumRatio = 0.5
# 默认为 0.3 取值范围: 0~1, 建议范围: 0.1~0.9
MosaicThr = 0.1
[Log]
# 日志存储目录,不能使用特殊符号
Dir = './logs'
# 记录级别 debug/info/warn/error
Level = 'debug'
# 保留日志多久,超过时间自动删除
MaxAge = '744h0m0s'
# 多久时间,分割一个新的日志文件
RotationTime = '8h0m0s'
# 多大文件,分割一个新的日志文件(MB)
RotationSize = 50

View File

@ -18,7 +18,7 @@
"homepage": "EasyVQD.html",
"icon": "EasyVQD.ico",
"updated_at": "2025-12-26",
"version": "v0.0.2",
"version": "v0.0.6",
"website": "https://www.tsingsee.com",
"activation": "service",
"status": ""

View File

@ -63,7 +63,7 @@ func setupRouter(r *gin.Engine, uc *Usecase) {
registerConfig(r, ConfigAPI{uc: uc, cfg: uc.Conf})
RegisterHostAPI(r, uc)
RegisterVqdTask(r, uc.VqdTaskAPI)
if !orm.GetEnabledAutoMigrate() {
if orm.GetEnabledAutoMigrate() {
recordErr(InitTemplate(uc))
}
r.NoRoute(func(ctx *gin.Context) {

View File

@ -1,3 +1,3 @@
VITE_API_BASE_URL=/api
VITE_WEB_BASE_URL=/
VITE_AUDIO_BASE_URL=/
VITE_SNAP_BASE_URL=

View File

@ -1,3 +1,3 @@
VITE_API_BASE_URL=/extensions/easyvqd/api
VITE_WEB_BASE_URL=/extensions/easyvqd/web
VITE_AUDIO_BASE_URL=/extensions/easyvqd/
VITE_SNAP_BASE_URL=/extensions/easyvqd

View File

@ -3,7 +3,7 @@
// } from '@/service/http/aiserver';
import { Image } from 'antd';
import React, { useState, useEffect } from 'react';
const snapBaseUrl = import.meta.env.VITE_SNAP_BASE_URL;
interface ISnapshot {
filePath: string;
}
@ -25,7 +25,7 @@ const Snapshot: React.FC<ISnapshot> = ({
width="100%"
height="130px"
fallback={'./assets/img/noImg.png'}
src={filePath || './assets/img/noImg.png'}
src={snapBaseUrl+filePath || './assets/img/noImg.png'}
/>
</>
);