Skip to content

Commit 555282b

Browse files
committed
Add support for splitMessages and timePerChar in Integrations
1 parent fa3132c commit 555282b

22 files changed

+364
-8
lines changed

src/pages/instance/Dify/DefaultSettingsDify.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ const FormSchema = z.object({
4343
debounceTime: z.string(),
4444
ignoreJids: z.array(z.string()).default([]),
4545
difyIdFallback: z.union([z.null(), z.string()]).optional(),
46+
splitMessages: z.boolean(),
47+
timePerChar: z.string(),
4648
});
4749

4850
function DefaultSettingsDify() {
@@ -75,6 +77,8 @@ function DefaultSettingsDify() {
7577
debounceTime: "0",
7678
ignoreJids: [],
7779
difyIdFallback: undefined,
80+
splitMessages: false,
81+
timePerChar: "0",
7882
},
7983
});
8084

@@ -95,6 +99,10 @@ function DefaultSettingsDify() {
9599
: "0",
96100
ignoreJids: settings.ignoreJids,
97101
difyIdFallback: settings.difyIdFallback,
102+
splitMessages: settings.splitMessages,
103+
timePerChar: settings.timePerChar
104+
? settings.timePerChar.toString()
105+
: "0",
98106
});
99107
}
100108
}, [settings]); // eslint-disable-line react-hooks/exhaustive-deps
@@ -116,6 +124,8 @@ function DefaultSettingsDify() {
116124
debounceTime: parseInt(data.debounceTime),
117125
difyIdFallback: data.difyIdFallback || undefined,
118126
ignoreJids: data.ignoreJids,
127+
splitMessages: data.splitMessages,
128+
timePerChar: parseInt(data.timePerChar),
119129
};
120130

121131
await setDefaultSettingsDify({
@@ -213,6 +223,19 @@ function DefaultSettingsDify() {
213223
<Input type="number" />
214224
</FormInput>
215225

226+
<FormSwitch
227+
name="splitMessages"
228+
label={t("dify.form.splitMessages.label")}
229+
reverse
230+
/>
231+
232+
<FormInput
233+
name="timePerChar"
234+
label={t("dify.form.timePerChar.label")}
235+
>
236+
<Input type="number" />
237+
</FormInput>
238+
216239
<FormTags
217240
name="ignoreJids"
218241
label={t("dify.form.ignoreJids.label")}

src/pages/instance/Dify/DifyForm.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ export const FormSchema = z.object({
3636
stopBotFromMe: z.boolean().optional(),
3737
keepOpen: z.boolean().optional(),
3838
debounceTime: z.coerce.number().optional(),
39+
splitMessages: z.boolean().optional(),
40+
timePerChar: z.coerce.number().optional(),
3941
});
4042

4143
export type FormSchemaType = z.infer<typeof FormSchema>;
@@ -81,6 +83,8 @@ function DifyForm({
8183
stopBotFromMe: false,
8284
keepOpen: false,
8385
debounceTime: 0,
86+
splitMessages: false,
87+
timePerChar: 0,
8488
},
8589
});
8690

@@ -247,6 +251,21 @@ function DifyForm({
247251
>
248252
<Input type="number" />
249253
</FormInput>
254+
255+
<FormSwitch
256+
name="splitMessages"
257+
label={t("dify.form.splitMessages.label")}
258+
reverse
259+
/>
260+
261+
{form.watch("splitMessages") && (
262+
<FormInput
263+
name="timePerChar"
264+
label={t("dify.form.timePerChar.label")}
265+
>
266+
<Input type="number" />
267+
</FormInput>
268+
)}
250269
</div>
251270

252271
{isModal && (

src/pages/instance/Dify/NewDify.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ function NewDify({ resetTable }: { resetTable: () => void }) {
5353
stopBotFromMe: data.stopBotFromMe || false,
5454
keepOpen: data.keepOpen || false,
5555
debounceTime: data.debounceTime || 0,
56+
splitMessages: data.splitMessages || false,
57+
timePerChar: data.timePerChar || 0,
5658
};
5759

5860
await createDify({

src/pages/instance/Dify/UpdateDify.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ function UpdateDify({ difyId, resetTable }: UpdateDifyProps) {
5050
stopBotFromMe: !!dify?.stopBotFromMe,
5151
keepOpen: !!dify?.keepOpen,
5252
debounceTime: dify?.debounceTime ?? 0,
53+
splitMessages: dify?.splitMessages ?? false,
54+
timePerChar: dify?.timePerChar ?? 0,
5355
}),
5456
[
5557
dify?.apiKey,
@@ -68,6 +70,8 @@ function UpdateDify({ difyId, resetTable }: UpdateDifyProps) {
6870
dify?.triggerType,
6971
dify?.triggerValue,
7072
dify?.unknownMessage,
73+
dify?.splitMessages,
74+
dify?.timePerChar,
7175
],
7276
);
7377

@@ -91,6 +95,8 @@ function UpdateDify({ difyId, resetTable }: UpdateDifyProps) {
9195
stopBotFromMe: data.stopBotFromMe || false,
9296
keepOpen: data.keepOpen || false,
9397
debounceTime: data.debounceTime || 0,
98+
splitMessages: data.splitMessages || false,
99+
timePerChar: data.timePerChar || 0,
94100
};
95101

96102
await updateDify({

src/pages/instance/EvolutionBot/DefaultSettingsEvolutionBot.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ const FormSchema = z.object({
4343
debounceTime: z.string(),
4444
ignoreJids: z.array(z.string()).default([]),
4545
botIdFallback: z.union([z.null(), z.string()]).optional(),
46+
splitMessages: z.boolean(),
47+
timePerChar: z.string(),
4648
});
4749

4850
function DefaultSettingsEvolutionBot() {
@@ -75,6 +77,8 @@ function DefaultSettingsEvolutionBot() {
7577
debounceTime: "0",
7678
ignoreJids: [],
7779
botIdFallback: undefined,
80+
splitMessages: false,
81+
timePerChar: "0",
7882
},
7983
});
8084

@@ -95,6 +99,10 @@ function DefaultSettingsEvolutionBot() {
9599
: "0",
96100
ignoreJids: settings.ignoreJids,
97101
botIdFallback: settings.botIdFallback,
102+
splitMessages: settings.splitMessages,
103+
timePerChar: settings.timePerChar
104+
? settings.timePerChar.toString()
105+
: "0",
98106
});
99107
}
100108
// eslint-disable-next-line react-hooks/exhaustive-deps
@@ -117,6 +125,8 @@ function DefaultSettingsEvolutionBot() {
117125
debounceTime: parseInt(data.debounceTime),
118126
botIdFallback: data.botIdFallback || undefined,
119127
ignoreJids: data.ignoreJids,
128+
splitMessages: data.splitMessages,
129+
timePerChar: parseInt(data.timePerChar),
120130
};
121131

122132
await setDefaultSettingsEvolutionBot({
@@ -219,6 +229,21 @@ function DefaultSettingsEvolutionBot() {
219229
<Input type="number" />
220230
</FormInput>
221231

232+
<FormSwitch
233+
name="splitMessages"
234+
label={t("evolutionBot.form.splitMessages.label")}
235+
reverse
236+
/>
237+
238+
{form.watch("splitMessages") && (
239+
<FormInput
240+
name="timePerChar"
241+
label={t("evolutionBot.form.timePerChar.label")}
242+
>
243+
<Input type="number" />
244+
</FormInput>
245+
)}
246+
222247
<FormTags
223248
name="ignoreJids"
224249
label={t("evolutionBot.form.ignoreJids.label")}

src/pages/instance/EvolutionBot/EvolutionBotForm.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ export const FormSchema = z.object({
3535
stopBotFromMe: z.boolean().optional(),
3636
keepOpen: z.boolean().optional(),
3737
debounceTime: z.coerce.number().optional(),
38+
splitMessages: z.boolean().optional(),
39+
timePerChar: z.coerce.number().optional(),
3840
});
3941

4042
export type FormSchemaType = z.infer<typeof FormSchema>;
@@ -79,6 +81,8 @@ function EvolutionBotForm({
7981
stopBotFromMe: false,
8082
keepOpen: false,
8183
debounceTime: 0,
84+
splitMessages: false,
85+
timePerChar: 0,
8286
},
8387
});
8488

@@ -239,6 +243,21 @@ function EvolutionBotForm({
239243
>
240244
<Input type="number" />
241245
</FormInput>
246+
247+
<FormSwitch
248+
name="splitMessages"
249+
label={t("evolutionBot.form.splitMessages.label")}
250+
reverse
251+
/>
252+
253+
{form.watch("splitMessages") && (
254+
<FormInput
255+
name="timePerChar"
256+
label={t("evolutionBot.form.timePerChar.label")}
257+
>
258+
<Input type="number" />
259+
</FormInput>
260+
)}
242261
</div>
243262

244263
{isModal && (

src/pages/instance/EvolutionBot/NewEvolutionBot.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ function NewEvolutionBot({ resetTable }: { resetTable: () => void }) {
5353
stopBotFromMe: data.stopBotFromMe || false,
5454
keepOpen: data.keepOpen || false,
5555
debounceTime: data.debounceTime || 0,
56+
splitMessages: data.splitMessages || false,
57+
timePerChar: data.timePerChar ? data.timePerChar : 0,
5658
};
5759

5860
await createEvolutionBot({

src/pages/instance/EvolutionBot/UpdateEvolutionBot.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ function UpdateEvolutionBot({
5252
stopBotFromMe: !!bot?.stopBotFromMe,
5353
keepOpen: !!bot?.keepOpen,
5454
debounceTime: bot?.debounceTime ?? 0,
55+
splitMessages: bot?.splitMessages ?? false,
56+
timePerChar: bot?.timePerChar ? bot?.timePerChar : 0,
5557
}),
5658
[
5759
bot?.apiKey,
@@ -69,6 +71,8 @@ function UpdateEvolutionBot({
6971
bot?.triggerType,
7072
bot?.triggerValue,
7173
bot?.unknownMessage,
74+
bot?.splitMessages,
75+
bot?.timePerChar,
7276
],
7377
);
7478

@@ -91,6 +95,8 @@ function UpdateEvolutionBot({
9195
stopBotFromMe: data.stopBotFromMe || false,
9296
keepOpen: data.keepOpen || false,
9397
debounceTime: data.debounceTime || 0,
98+
splitMessages: data.splitMessages || false,
99+
timePerChar: data.timePerChar ? data.timePerChar : 0,
94100
};
95101

96102
await updateEvolutionBot({

src/pages/instance/Flowise/DefaultSettingsFlowise.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ const FormSchema = z.object({
4343
debounceTime: z.string(),
4444
ignoreJids: z.array(z.string()).default([]),
4545
flowiseIdFallback: z.union([z.null(), z.string()]).optional(),
46+
splitMessages: z.boolean(),
47+
timePerChar: z.string(),
4648
});
4749

4850
function DefaultSettingsFlowise() {
@@ -74,6 +76,8 @@ function DefaultSettingsFlowise() {
7476
debounceTime: "0",
7577
ignoreJids: [],
7678
flowiseIdFallback: undefined,
79+
splitMessages: false,
80+
timePerChar: "0",
7781
},
7882
});
7983

@@ -94,6 +98,10 @@ function DefaultSettingsFlowise() {
9498
: "0",
9599
ignoreJids: settings.ignoreJids,
96100
flowiseIdFallback: settings.flowiseIdFallback,
101+
splitMessages: settings.splitMessages,
102+
timePerChar: settings.timePerChar
103+
? settings.timePerChar.toString()
104+
: "0",
97105
});
98106
}
99107
// eslint-disable-next-line react-hooks/exhaustive-deps
@@ -116,6 +124,8 @@ function DefaultSettingsFlowise() {
116124
debounceTime: parseInt(data.debounceTime),
117125
flowiseIdFallback: data.flowiseIdFallback || undefined,
118126
ignoreJids: data.ignoreJids,
127+
splitMessages: data.splitMessages,
128+
timePerChar: parseInt(data.timePerChar),
119129
};
120130

121131
await setDefaultSettingsFlowise({
@@ -215,6 +225,21 @@ function DefaultSettingsFlowise() {
215225
<Input type="number" />
216226
</FormInput>
217227

228+
<FormSwitch
229+
name="splitMessages"
230+
label={t("flowise.form.splitMessages.label")}
231+
reverse
232+
/>
233+
234+
{form.watch("splitMessages") && (
235+
<FormInput
236+
name="timePerChar"
237+
label={t("flowise.form.timePerChar.label")}
238+
>
239+
<Input type="number" />
240+
</FormInput>
241+
)}
242+
218243
<FormTags
219244
name="ignoreJids"
220245
label={t("flowise.form.ignoreJids.label")}

src/pages/instance/Flowise/FlowiseForm.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ export const FormSchema = z.object({
3535
stopBotFromMe: z.boolean().optional(),
3636
keepOpen: z.boolean().optional(),
3737
debounceTime: z.coerce.number().optional(),
38+
splitMessages: z.boolean().optional(),
39+
timePerChar: z.coerce.number().optional(),
3840
});
3941

4042
export type FormSchemaType = z.infer<typeof FormSchema>;
@@ -79,6 +81,8 @@ function FlowiseForm({
7981
stopBotFromMe: false,
8082
keepOpen: false,
8183
debounceTime: 0,
84+
splitMessages: false,
85+
timePerChar: 0,
8286
},
8387
});
8488

@@ -239,6 +243,21 @@ function FlowiseForm({
239243
>
240244
<Input type="number" />
241245
</FormInput>
246+
247+
<FormSwitch
248+
name="splitMessages"
249+
label={t("flowise.form.splitMessages.label")}
250+
reverse
251+
/>
252+
253+
{form.watch("splitMessages") && (
254+
<FormInput
255+
name="timePerChar"
256+
label={t("flowise.form.timePerChar.label")}
257+
>
258+
<Input type="number" />
259+
</FormInput>
260+
)}
242261
</div>
243262

244263
{isModal && (

0 commit comments

Comments
 (0)