Skip to content

Commit f93a34a

Browse files
fix(ai): Fixed issue with delete hermes-agent failed (#12499)
1 parent 4e78841 commit f93a34a

4 files changed

Lines changed: 22 additions & 3 deletions

File tree

agent/app/service/agents_utils.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,10 @@ func buildAgentItem(agent *model.Agent, appInstall *model.AppInstall, envMap map
386386
return item
387387
}
388388

389+
func isAgentAppKey(appKey string) bool {
390+
return appKey == constant.AppOpenclaw || appKey == constant.AppCopaw || appKey == constant.AppHermesAgent
391+
}
392+
389393
func isOpenclawLegacyHTTPVersion(version string) bool {
390394
return !common.CompareAppVersion(version, openclawHTTPSVersion)
391395
}

agent/app/service/app_utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ func deleteAppInstall(deleteReq request.AppInstallDelete) error {
392392
return err
393393
}
394394
appKey := install.App.Key
395-
if appKey == constant.AppOpenclaw || appKey == constant.AppCopaw {
395+
if isAgentAppKey(appKey) {
396396
_ = agentRepo.DeleteByAppInstallIDWithCtx(ctx, install.ID)
397397
}
398398

agent/app/service/website.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,17 @@ func (w WebsiteService) CreateWebsite(create request.WebsiteCreate) (err error)
379379
req request.AppInstallCreate
380380
install *model.AppInstall
381381
)
382+
appDetail, err := appDetailRepo.GetFirst(repo.WithByID(create.AppInstall.AppDetailId))
383+
if err != nil {
384+
return err
385+
}
386+
app, err := appRepo.GetFirst(repo.WithByID(appDetail.AppId))
387+
if err != nil {
388+
return err
389+
}
390+
if isAgentAppKey(app.Key) {
391+
return fmt.Errorf("%s does not support website deployment", app.Key)
392+
}
382393
req.Name = create.AppInstall.Name
383394
req.AppDetailId = create.AppInstall.AppDetailId
384395
req.Params = create.AppInstall.Params

frontend/src/views/website/website/create/index.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
:key="index"
6969
:label="app.name"
7070
:value="app.id"
71-
:disabled="app.key == 'openclaw'"
71+
:disabled="isRestrictedDeploymentApp(app.key)"
7272
></el-option>
7373
</el-select>
7474
</el-form-item>
@@ -694,6 +694,10 @@ const getProxyTargetFromApp = (app: Pick<App.AppInstalled, 'httpPort' | 'httpsPo
694694
};
695695
};
696696
697+
const isRestrictedDeploymentApp = (appKey?: string) => {
698+
return appKey === 'openclaw' || appKey === 'copaw' || appKey === 'hermes-agent';
699+
};
700+
697701
const changeInstall = () => {
698702
appInstalls.value.forEach((app) => {
699703
if (app.id === website.value.appInstallId) {
@@ -708,7 +712,7 @@ const searchAppList = () => {
708712
searchApp(appReq).then((res) => {
709713
apps.value = res.data.items;
710714
711-
const selectableApp = res.data.items.find((item) => item.key !== 'openclaw');
715+
const selectableApp = res.data.items.find((item) => !isRestrictedDeploymentApp(item.key));
712716
if (selectableApp) {
713717
website.value.appinstall.appId = selectableApp.id;
714718
website.value.appinstall.appkey = selectableApp.key;

0 commit comments

Comments
 (0)