mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-09-22 16:00:51 +00:00
feat: Optimize plugin installation logic (#12312)
This commit is contained in:
@@ -73,6 +73,7 @@ const (
|
||||
defaultToolsSessionVisibility = "all"
|
||||
maxCommunityAIAgents = int64(5)
|
||||
openclawPluginBaseDir = "/home/node/.openclaw/extensions"
|
||||
openclawPluginPackageTmpDir = "/tmp/openclaw-plugin"
|
||||
openclawGatewayPort = 18789
|
||||
openclawAllowedOriginHost = "127.0.0.1"
|
||||
openclawHTTPSVersion = "2026.3.13"
|
||||
|
||||
@@ -169,12 +169,12 @@ func (a AgentService) InstallPlugin(req dto.AgentPluginInstallReq) error {
|
||||
if req.Type == "qqbot" {
|
||||
legacyPluginPath := path.Join(openclawPluginBaseDir, "qqbot")
|
||||
if err := mgr.RunBashCf("docker exec %s test -d %s", install.ContainerName, legacyPluginPath); err == nil {
|
||||
if err := mgr.RunBashCf("printf 'yes\\n' | docker exec -i %s openclaw plugins uninstall qqbot", install.ContainerName); err != nil {
|
||||
if err := mgr.Run("docker", "exec", "-i", install.ContainerName, "sh", "-c", "printf 'yes\\n' | openclaw plugins uninstall qqbot"); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
if err := mgr.RunBashCf("docker exec %s openclaw plugins install %s", install.ContainerName, spec); err != nil {
|
||||
if err := mgr.Run("docker", "exec", install.ContainerName, "sh", "-c", buildOpenclawPluginInstallScript(spec, pluginID)); err != nil {
|
||||
return err
|
||||
}
|
||||
conf, err := readOpenclawConfig(agent.ConfigPath)
|
||||
@@ -576,6 +576,15 @@ func appendPluginAllow(conf map[string]interface{}, pluginID string) {
|
||||
plugins["allow"] = append(allow, pluginID)
|
||||
}
|
||||
|
||||
func buildOpenclawPluginInstallScript(spec, pluginID string) string {
|
||||
return fmt.Sprintf(
|
||||
"set -e; workdir=%s/%s; rm -rf \"$workdir\"; mkdir -p \"$workdir\"; cd \"$workdir\"; npm pack --silent %q >/dev/null 2>&1; pkg=$(find \"$workdir\" -maxdepth 1 -type f -name '*.tgz' | head -n 1); printf '%%s\\n' \"$pkg\"; openclaw plugins install \"$pkg\"; rm -rf \"$workdir\"",
|
||||
openclawPluginPackageTmpDir,
|
||||
pluginID,
|
||||
spec,
|
||||
)
|
||||
}
|
||||
|
||||
func resolvePluginMeta(pluginType string) (string, string, error) {
|
||||
switch pluginType {
|
||||
case "qqbot":
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<el-tabs v-model="activeTab" @tab-click="handleTabClick">
|
||||
<el-tab-pane label="QQ" name="qqbot">
|
||||
<QQBotTab ref="qqbotRef" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="t('aiTools.agents.weixin')" name="weixin">
|
||||
<WeixinTab ref="weixinRef" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="QQ" name="qqbot">
|
||||
<QQBotTab ref="qqbotRef" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="t('aiTools.agents.wecom')" name="wecom">
|
||||
<WecomTab ref="wecomRef" />
|
||||
</el-tab-pane>
|
||||
@@ -36,7 +36,7 @@ import WecomTab from './channels/wecom.vue';
|
||||
import DingTalkTab from './channels/dingtalk.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const activeTab = ref('qqbot');
|
||||
const activeTab = ref('weixin');
|
||||
const agentId = ref(0);
|
||||
const feishuRef = ref();
|
||||
const telegramRef = ref();
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
</div>
|
||||
</el-tooltip>
|
||||
<div class="skill-tags">
|
||||
<el-tag class="skill-source-tag" size="small" effect="plain">
|
||||
<el-tag size="small" effect="plain">
|
||||
{{ group.tagLabel }}
|
||||
</el-tag>
|
||||
</div>
|
||||
@@ -241,6 +241,7 @@ defineExpose({
|
||||
|
||||
.skill-name {
|
||||
font-weight: 600;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.skill-desc {
|
||||
|
||||
Reference in New Issue
Block a user