bugfix
This commit is contained in:
parent
1492421c79
commit
f3f2a86d65
71
build.sh
Normal file
71
build.sh
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# clone from git@git.opencomputing.cn/yumoqing/kyrag
|
||||||
|
# git clone https://git.opencomputing.cn/yumoqing/kyrag
|
||||||
|
cd ..
|
||||||
|
dir=$(pwd)
|
||||||
|
git clone https://git.opencomputing.cn/yumoqing/appbase
|
||||||
|
git clone https://git.opencomputing.cn/yumoqing/rbac
|
||||||
|
git clone https://git.opencomputing.cn/yumoqing/filemgr
|
||||||
|
git clone https://git.opencomputing.cn/yumoqing/rag
|
||||||
|
git clone https://git.opencomputing.cn/yumoqing/dapi
|
||||||
|
cd kyrag
|
||||||
|
cdir=$(pwd)
|
||||||
|
uname=$(id -un)
|
||||||
|
gname=$(id -gn)
|
||||||
|
python3 -m venv py3
|
||||||
|
source py3/bin/activate
|
||||||
|
pip install -r requirements.txt
|
||||||
|
for m in appbase rbac filemgr rag dapi
|
||||||
|
do
|
||||||
|
cd $dir/$m
|
||||||
|
pip install .
|
||||||
|
cd models
|
||||||
|
xls2ddl mysql . > mysql.ddl.sql
|
||||||
|
mysql -h db -utest -ptest123 kyrag < mysql.ddl.sql
|
||||||
|
cd ../json
|
||||||
|
./build
|
||||||
|
ln -s $dir/$m/wwwroot $cdir/wwwroot/$m
|
||||||
|
done
|
||||||
|
ln -s /d/public/bricks $cdir/wwwroot
|
||||||
|
cd $cdir
|
||||||
|
cat > $cdir/kyrag.service <<EOF
|
||||||
|
[Unit]
|
||||||
|
Wants=systemd-networkd.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=$uname
|
||||||
|
Group=$gname
|
||||||
|
Type=forking
|
||||||
|
WorkingDirectory=$cdur
|
||||||
|
ExecStart=$cdir/start.sh
|
||||||
|
ExecStop=$cdir/stop.sh
|
||||||
|
StandardOutput=append:/var/log/kyrag/kyrag.log
|
||||||
|
StandardError=append:/var/log/kyrag/kyrag.log
|
||||||
|
SyslogIdentifier=kyrag
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
cat > $cdir/start.sh <<EOF
|
||||||
|
#!/usr/bin/bash
|
||||||
|
cd $cdir
|
||||||
|
$cdir/py3/bin/python $cdir/app/kyrag.py -p 9182 -w $cdir &
|
||||||
|
exit 0
|
||||||
|
EOF
|
||||||
|
cat > $cdir/stop.sh <<EOF
|
||||||
|
PORT=9182
|
||||||
|
PID=\$(lsof -t -i:$PORT)
|
||||||
|
|
||||||
|
if [ -n "\$PID" ]; then
|
||||||
|
echo "找到端口 $PORT 的进程: PID=\$PID"
|
||||||
|
kill -9 \$PID
|
||||||
|
echo "已终止端口 $PORT 的进程"
|
||||||
|
else
|
||||||
|
echo "未找到端口 $PORT 的进程"
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
|
chmod +x $cdir/start.sh stop.sh
|
||||||
|
sudo mkdir /var/log/kyrag
|
||||||
|
sudo cp kyrag.service /etc/systemd/system
|
||||||
|
sudo systemctl enable kyrag
|
||||||
|
sudo systemctl restart kyrag
|
||||||
41
wwwroot/app_panel.ui
Normal file
41
wwwroot/app_panel.ui
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"widgettype":"HBox",
|
||||||
|
"options":{
|
||||||
|
"css":"filler"
|
||||||
|
},
|
||||||
|
"subwidgets":[
|
||||||
|
{
|
||||||
|
"widgettype":"Image",
|
||||||
|
"options":{
|
||||||
|
"height":"100%",
|
||||||
|
"tip":"进入主菜单",
|
||||||
|
"css":"clickable",
|
||||||
|
"url":"{{entire_url('/imgs/opencomputing-1.png')}}"
|
||||||
|
},
|
||||||
|
"binds":[
|
||||||
|
{
|
||||||
|
"wid":"self",
|
||||||
|
"event":"click",
|
||||||
|
"actiontype":"urlwidget",
|
||||||
|
"target":"Popup",
|
||||||
|
"popup_options":{
|
||||||
|
"eventpos":true,
|
||||||
|
"dismiss_events":["command"]
|
||||||
|
},
|
||||||
|
"options":{
|
||||||
|
"url":"{{entire_url('menu.ui')}}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype":"Title4",
|
||||||
|
"options":{
|
||||||
|
"i18n":true,
|
||||||
|
"otext":"大模型应用平台",
|
||||||
|
"wrap":true,
|
||||||
|
"halign":"left"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
17
wwwroot/bottom.ui
Normal file
17
wwwroot/bottom.ui
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"widgettype":"HBox",
|
||||||
|
"options":{
|
||||||
|
"cheight":2,
|
||||||
|
"bgcolor":"#e5e5e5"
|
||||||
|
},
|
||||||
|
"subwidgets":[
|
||||||
|
{
|
||||||
|
"widgettype":"Text",
|
||||||
|
"options":{
|
||||||
|
"otext":"© 2024 版权所有, 开元云(北京)科技有限公司",
|
||||||
|
"i18n":true,
|
||||||
|
"wrap":true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
1
wwwroot/imgs/rag.svg
Normal file
1
wwwroot/imgs/rag.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg t="1753683820621" class="icon" viewBox="0 0 1280 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6699" width="100%" height="100%"><path d="M704.08692 249l-103.8-26c-13-3.2-22.6-14.2-24-27.6s5.6-26.2 17.4-32.2l81.6-40.8-86.4-64.8c-11-8.2-15.6-22.6-11.2-35.8S594.28692 0 608.08692 0h320c60.4 0 117.4 28.4 153.6 76.8l115.2 153.6c12.4 16.6 19.2 36.8 19.2 57.6 0 53-43 96-96 96h-43c-34 0-66.6-13.4-90.6-37.4L960.08692 320h-64v43c0 49.6 25.6 95.8 67.6 122.2l213.2 133.2c64.2 40.2 103.2 110.4 103.2 186.2 0 121.2-98.2 219.4-219.6 219.4H64.68692c-6.6 0-13.2-0.8-19.2-2.8-18.4-5.6-33.4-19.2-40.6-37C2.08692 977.4 0.48692 970.4 0.08692 962.8c-0.4-7.4 0.6-14.6 2.6-21.4 5.6-18.4 19.2-33.4 37.2-40.8 6-2.4 12.4-4 19-4.4L866.68692 824c16.6-1.4 29.4-15.4 29.4-32.2 0-8.6-3.4-16.8-9.4-22.8l-88.8-88.8c-60-60-93.8-141.4-93.8-226.2V249z m320-104.4V144v-0.6 1.2z m-2.6 14.8l-92.8-23.2c-0.4 2.6-0.6 5.2-0.6 7.8 0 26.6 21.4 48 48 48 21.2 0 39-13.6 45.4-32.6z m-759.6 73.6c32.6-29 80.8-32.4 117-8.2l261.2 174V454c0 65.6 16.8 129.6 48 186H224.08692c-13.4 0-25.4-8.4-30-20.8s-1-26.6 9.2-35.4l138.8-119.2-305.2 47c-14 2.2-27.8-5.2-33.8-18S0.08692 465.4 10.68692 456l251.2-223z" fill="${color}" p-id="6700"></path></svg>
|
||||||
|
After Width: | Height: | Size: 1.2 KiB |
@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"widgettype":"VBox",
|
||||||
|
"options":{
|
||||||
|
"width":"100%",
|
||||||
|
"height":"100%",
|
||||||
|
"bgimage":"{{entire_url('/imgs/bgimage.jpg')}}"
|
||||||
|
},
|
||||||
|
"subwidgets":[
|
||||||
|
{
|
||||||
|
"widgettype":"urlwidget",
|
||||||
|
"options":{
|
||||||
|
"url":"{{entire_url('top.ui')}}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype":"urlwidget",
|
||||||
|
"options":{
|
||||||
|
"url":"{{entire_url('center.ui')}}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype":"urlwidget",
|
||||||
|
"options":{
|
||||||
|
"url":"{{entire_url('bottom.ui')}}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
283
wwwroot/menu.ui
Normal file
283
wwwroot/menu.ui
Normal file
@ -0,0 +1,283 @@
|
|||||||
|
{% set roles = get_user_roles(get_user()) %}
|
||||||
|
{
|
||||||
|
"widgettype":"Menu",
|
||||||
|
"options":{
|
||||||
|
"target":"PopupWindow",
|
||||||
|
"cwidth":10,
|
||||||
|
"items":[
|
||||||
|
{
|
||||||
|
"name":"home",
|
||||||
|
"label":"主页",
|
||||||
|
"url":"{{entire_url('public')}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"user",
|
||||||
|
"label":"用户",
|
||||||
|
"items":[
|
||||||
|
{% if get_user() is None %}
|
||||||
|
{
|
||||||
|
"label": "登录",
|
||||||
|
"url":"{{entire_url('/rbac/user/login.ui')}},
|
||||||
|
"name":"login",
|
||||||
|
"tip":"点击登录",
|
||||||
|
"icon":"{{entire_url('/bricks/imgs/login.svg')}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"register",
|
||||||
|
"label":"注册",
|
||||||
|
"url":"{{entire_url('/rbac/user/register.ui')}}",
|
||||||
|
"tip":"点击注册",
|
||||||
|
"icon":"{{entire_url('/bricks/imgs/register.svg')}}"
|
||||||
|
}
|
||||||
|
{% else %}
|
||||||
|
{
|
||||||
|
"label":"用户功能",
|
||||||
|
"url":"{{entire_url('/rbac/user/user_menu.ui')}}",
|
||||||
|
"name":"userfunc",
|
||||||
|
"tip":"登录用户功能"
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
{
|
||||||
|
"name":"config",
|
||||||
|
"label":"配置",
|
||||||
|
"items":[
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"kdb",
|
||||||
|
"label":"知识库",
|
||||||
|
"items":[
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name“:"craw",
|
||||||
|
"label":"知识获取",
|
||||||
|
"items":[
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{% if 'customer.customer' in roles %}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
"name":"kdb",
|
||||||
|
"label":"知识库管理",
|
||||||
|
"items":[
|
||||||
|
{
|
||||||
|
"name": "mykdb",
|
||||||
|
"icon": "{{entire_url('/imgs/kdb.svg')}}",
|
||||||
|
"label":"我的知识库",
|
||||||
|
"url": "{{entire_url('kdb/kdb')}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "folder",
|
||||||
|
"icon": "{{entire_url('/imgs/folder.svg')}}",
|
||||||
|
"label":"文件管理",
|
||||||
|
"url": "{{entire_url('kdb/folderinfo')}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "crawling",
|
||||||
|
"icon": "{{entire_url('/imgs/crawling.svg')}}",
|
||||||
|
"label":"爬取管理",
|
||||||
|
"url": "{{entire_url('kdb/crawling_schedule')}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "urlorigin",
|
||||||
|
"icon": "{{entire_url('/imgs/urlorigin.svg')}}",
|
||||||
|
"label":"网上知识源",
|
||||||
|
"url": "{{entire_url('kdb/urlorigin')}}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"customize",
|
||||||
|
"label":"开源模型私有化",
|
||||||
|
"url":"{{entire_url('customize/requirements.ui')}}"
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
|
{% if 'owner.superuser' in roles %}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
"name":"sysmgr",
|
||||||
|
"label":"系统管理",
|
||||||
|
"items":{% include '/appbase/menu.ui' %}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"addadmin",
|
||||||
|
"label":"添加管理员",
|
||||||
|
"url":"{{entire_url('rbac/add_adminuser.ui')}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"role",
|
||||||
|
"label":"配置账务",
|
||||||
|
"items":[{
|
||||||
|
"name":"subject",
|
||||||
|
"label":"科目配置",
|
||||||
|
"url":"{{entire_url('accounting/subject')}}"
|
||||||
|
},{
|
||||||
|
"name":"account_config",
|
||||||
|
"label":"参与方科目配置",
|
||||||
|
"url":"{{entire_url('accounting/account_config')}}"
|
||||||
|
},{
|
||||||
|
"name":"accounting_config",
|
||||||
|
"label":"会计分录配置",
|
||||||
|
"url":"{{entire_url('accounting/accounting_config')}}"
|
||||||
|
},{
|
||||||
|
"name":"open_account",
|
||||||
|
"label":"开帐",
|
||||||
|
"url":"{{entire_url('accounting/open_account.ui')}}"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"role",
|
||||||
|
"label":"角色管理",
|
||||||
|
"url":"{{entire_url('rbac/role')}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"permission",
|
||||||
|
"label":"权限管理",
|
||||||
|
"url":"{{entire_url('rbac/permission')}}"
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
|
{% if 'reseller.operator' in roles or 'customer.operator' in roles or 'owner.operator' in roles %}
|
||||||
|
,{
|
||||||
|
"name": "msp",
|
||||||
|
"label": "服务管理",
|
||||||
|
"items":[
|
||||||
|
{
|
||||||
|
"name":"devgroup",
|
||||||
|
"label":"设备组",
|
||||||
|
"url":"{{entire_url('msp/devgroup')}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"service",
|
||||||
|
"label":"服务目录",
|
||||||
|
"url":"{{entire_url('msp/mspcatelog')}}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
,{
|
||||||
|
"name": "upappconfig",
|
||||||
|
"label": "统一API",
|
||||||
|
"items":[
|
||||||
|
{
|
||||||
|
"name":"apiset",
|
||||||
|
"label":"接口集",
|
||||||
|
"url":"{{entire_url('uapi/uapiset')}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"upapp",
|
||||||
|
"label":"上位系统",
|
||||||
|
"url":"{{entire_url('uapi/upapp')}}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
|
{% if 'owner.operator' in roles %}
|
||||||
|
,{
|
||||||
|
"name":"prodtype",
|
||||||
|
"label":"产品类型管理",
|
||||||
|
"url":"{{entire_url('/platformbiz/prodtype')}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"prodtypespec",
|
||||||
|
"label":"产品类型规格",
|
||||||
|
"url":"{{entire_url('/platformbiz/prodtypespec')}}"
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
|
{% if 'provider.operator' in roles %}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
"name":"product",
|
||||||
|
"label":"产品管理",
|
||||||
|
"url":"{{entire_url('/platformbiz/product')}}"
|
||||||
|
}
|
||||||
|
,{
|
||||||
|
"name":"reseller",
|
||||||
|
"label":"分销协议",
|
||||||
|
"url":"{{entire_url('/platformbiz/retail_agree')}}"
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
|
{% if 'reseller.operator' in roles or 'customer.operator' in roles %}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
"name":"addprovider",
|
||||||
|
"label":"添加供应商",
|
||||||
|
"url":"{{entire_url('/platformbiz/add_provider.ui')}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"providermgr",
|
||||||
|
"label":"供应协议",
|
||||||
|
"url":"{{entire_url('/platformbiz/provide_agree')}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"product",
|
||||||
|
"label":"产品管理",
|
||||||
|
"url":"{{entire_url('/platformbiz/product')}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"apikey",
|
||||||
|
"label":"apikey管理",
|
||||||
|
"url":"{{entire_url('/basellm/userapikey')}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"api",
|
||||||
|
"label":"接口管理",
|
||||||
|
"url":"{{entire_url('/basellm/httpapi')}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"models",
|
||||||
|
"label":"模型管理",
|
||||||
|
"items":[
|
||||||
|
{
|
||||||
|
"name":"model",
|
||||||
|
"label":"模型类型",
|
||||||
|
"url":"{{entire_url('/basellm/modeltype')}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"model",
|
||||||
|
"label":"模型管理",
|
||||||
|
"url":"{{entire_url('/basellm/models')}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"instance",
|
||||||
|
"label":"模型实例管理",
|
||||||
|
"url":"{{entire_url('/basellm/modelinstance')}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"modelpricing",
|
||||||
|
"label":"模型定价",
|
||||||
|
"url":"{{entire_url('/basellm/modelpricing')}}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
|
{% if 'reseller.accountant' in roles %}
|
||||||
|
{% endif %}
|
||||||
|
{% if 'reseller.sale' in roles %}
|
||||||
|
,{
|
||||||
|
"name":"reseller",
|
||||||
|
"label":"分销协议",
|
||||||
|
"url":"{{entire_url('/platformbiz/retail_agree')}}"
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
|
{% if 'custmer.admin' in roles %}
|
||||||
|
,{
|
||||||
|
"name":"users",
|
||||||
|
"label":"用户管理",
|
||||||
|
"url":"{{entire_url('/rbac/users')}}"
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
|
{% if 'reseller.admin' in roles %}
|
||||||
|
,{
|
||||||
|
"name":"users",
|
||||||
|
"label":"用户管理",
|
||||||
|
"url":"{{entire_url('/rbac/users')}}"
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
42
wwwroot/top.ui
Normal file
42
wwwroot/top.ui
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"id":"top_panel",
|
||||||
|
"widgettype":"HBox",
|
||||||
|
"options":{
|
||||||
|
"bgcolor":"#444444",
|
||||||
|
"cheight":2.5,
|
||||||
|
"color":"#eeeeee"
|
||||||
|
},
|
||||||
|
"subwidgets":[
|
||||||
|
{
|
||||||
|
"widgettype":"urlwidget",
|
||||||
|
"options":{
|
||||||
|
"url":"{{entire_url('app_panel.ui')}}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype":"Svg",
|
||||||
|
"options":{
|
||||||
|
"css": "clickable",
|
||||||
|
"topMargin": "10px",
|
||||||
|
"rate": 1.8,
|
||||||
|
"tip": "show all the closed window",
|
||||||
|
"url":"{{entire_url('/bricks/imgs/app-dock.svg')}}"
|
||||||
|
},
|
||||||
|
"binds":[
|
||||||
|
{
|
||||||
|
"wid": "self",
|
||||||
|
"event": "click",
|
||||||
|
"actiontype":"script",
|
||||||
|
"target":"app",
|
||||||
|
"script": "bricks.app.show_windows_panel(event)"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype":"urlwidget",
|
||||||
|
"options":{
|
||||||
|
"url":"{{entire_url('/rbac/user/user_panel.ui')}}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user