Skip to content

Commit 6528ffe

Browse files
feat: Modify the configuration of the OpenClaw DingTalk channel.
1 parent 67a8ba2 commit 6528ffe

5 files changed

Lines changed: 20 additions & 23 deletions

File tree

agent/app/service/agents_channels.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ func extractDingTalkConfig(conf map[string]interface{}) dto.AgentDingTalkConfig
852852
bots = append(bots, dto.AgentDingTalkBot{
853853
AgentChannelBotBase: dto.AgentChannelBotBase{
854854
AccountID: accountID,
855-
Name: extractDisplayName(account, accountID, accountID),
855+
Name: accountID,
856856
Enabled: extractBoolValue(account["enabled"], true),
857857
},
858858
ClientID: extractStringValue(account["clientId"]),
@@ -896,12 +896,12 @@ func setDingTalkConfig(conf map[string]interface{}, config dto.AgentDingTalkConf
896896
dingtalk["enabled"] = effectiveEnabled
897897
dingtalk["dmPolicy"] = config.DmPolicy
898898
dingtalk["groupPolicy"] = config.GroupPolicy
899-
dingtalk["gatewayToken"] = extractGatewayToken(conf)
900899
dingtalk["separateSessionByConversation"] = config.SeparateSessionByConversation
901900
dingtalk["groupSessionScope"] = config.GroupSessionScope
902901
dingtalk["sharedMemoryAcrossConversations"] = config.SharedMemoryAcrossConversations
903902
dingtalk["asyncMode"] = config.AsyncMode
904903
dingtalk["ackText"] = config.AckText
904+
delete(dingtalk, "gatewayToken")
905905
switch config.DmPolicy {
906906
case "open":
907907
dingtalk["allowFrom"] = []string{"*"}
@@ -922,7 +922,6 @@ func setDingTalkConfig(conf map[string]interface{}, config dto.AgentDingTalkConf
922922
for _, bot := range config.Bots {
923923
accounts[bot.AccountID] = map[string]interface{}{
924924
"enabled": bot.Enabled,
925-
"name": bot.Name,
926925
"clientId": bot.ClientID,
927926
"clientSecret": bot.ClientSecret,
928927
}

agent/app/service/agents_utils.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,19 +1498,6 @@ func extractStringList(value interface{}) []string {
14981498
}
14991499
}
15001500

1501-
func extractGatewayToken(conf map[string]interface{}) string {
1502-
gateway, ok := conf["gateway"].(map[string]interface{})
1503-
if !ok {
1504-
return ""
1505-
}
1506-
auth, ok := gateway["auth"].(map[string]interface{})
1507-
if !ok {
1508-
return ""
1509-
}
1510-
token, _ := auth["token"].(string)
1511-
return token
1512-
}
1513-
15141501
func ensureChildMap(parent map[string]interface{}, key string) map[string]interface{} {
15151502
if child, ok := parent[key].(map[string]interface{}); ok {
15161503
return child

frontend/src/api/modules/ai.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,5 +315,5 @@ export const installAgentSkill = (req: AI.AgentSkillInstallReq) => {
315315
};
316316

317317
export const approveAgentChannelPairing = (req: AI.AgentChannelPairingApproveReq) => {
318-
return http.post(`/ai/agents/channel/pairing/approve`, req);
318+
return http.post(`/ai/agents/channel/pairing/approve`, req, TimeoutEnum.T_60S);
319319
};

frontend/src/views/ai/agents/agent/config/tabs/channels/components/channel-bots.vue

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<el-table-column :label="t('commons.table.name')" min-width="140">
1111
<template #default="{ row }">
1212
<div class="channel-bots__name">
13-
<span>{{ row.name }}</span>
13+
<span>{{ row.name || row.accountId }}</span>
1414
<el-tag v-if="row.isDefault" type="success" size="small">
1515
{{ t('commons.table.default') }}
1616
</el-tag>
@@ -76,7 +76,7 @@
7676

7777
<DialogPro v-model="dialogVisible" :title="dialogTitle">
7878
<el-form ref="formRef" :model="form" :rules="rules" label-position="top">
79-
<el-form-item :label="t('commons.table.name')" prop="name">
79+
<el-form-item v-if="showNameField" :label="t('commons.table.name')" prop="name">
8080
<el-input v-model="form.name" :disabled="disabled" />
8181
</el-form-item>
8282
<el-form-item :label="t('aiTools.agents.accountId')" prop="accountId">
@@ -201,6 +201,10 @@ const props = defineProps({
201201
type: Boolean,
202202
default: false,
203203
},
204+
showNameField: {
205+
type: Boolean,
206+
default: true,
207+
},
204208
undeletableAccountIds: {
205209
type: Array as PropType<string[]>,
206210
default: () => [],
@@ -230,7 +234,6 @@ const dialogTitle = computed(() => (editIndex.value >= 0 ? t('commons.button.edi
230234
231235
const rules = computed<FormRules>(() => {
232236
const config: FormRules = {
233-
name: [Rules.requiredInput],
234237
accountId: [
235238
Rules.appName,
236239
{
@@ -248,6 +251,9 @@ const rules = computed<FormRules>(() => {
248251
},
249252
],
250253
};
254+
if (props.showNameField) {
255+
config.name = [Rules.requiredInput];
256+
}
251257
for (const field of props.fields) {
252258
if (!field.required) {
253259
continue;
@@ -296,13 +302,17 @@ const saveBot = async () => {
296302
}
297303
await formRef.value.validate();
298304
const nextBots = props.bots.map((bot) => ({ ...bot }));
305+
const nextBot = { ...form };
306+
if (!props.showNameField) {
307+
nextBot.name = nextBot.accountId;
308+
}
299309
if (editIndex.value >= 0) {
300-
nextBots.splice(editIndex.value, 1, { ...form });
310+
nextBots.splice(editIndex.value, 1, nextBot);
301311
} else {
302312
if (props.defaultable && nextBots.every((bot) => !bot.isDefault)) {
303-
form.isDefault = true;
313+
nextBot.isDefault = true;
304314
}
305-
nextBots.push({ ...form });
315+
nextBots.push(nextBot);
306316
}
307317
emitBots(nextBots);
308318
dialogVisible.value = false;

frontend/src/views/ai/agents/agent/config/tabs/channels/dingtalk.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
:bots="form.bots"
8181
:fields="botFields"
8282
:create-bot="createBot"
83+
:show-name-field="false"
8384
summary-label="Client ID"
8485
:summary-formatter="getBotSummary"
8586
:add-disabled="!installed"

0 commit comments

Comments
 (0)