Skip to content

Commit 3537ea3

Browse files
authored
Merge pull request #67 from Dialogue-Bot/DIAL-42-implement-test-your-bot
feat: permit yes prompt, variable to connect to multiple node
2 parents 53bb339 + 498b8cc commit 3537ea3

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

client/src/components/forms/variables-setting.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ const stringifyVariableValue = (value: any, type: string) => {
6262
.replace(/"/g, '')
6363

6464
if (type === 'object') return JSON.stringify(value, null, 2)
65+
66+
if (type === 'string') return JSON.stringify(value).replace(/"/g, '')
67+
6568
return JSON.stringify(value)
6669
}
6770

client/src/components/pages/flow-detail/flow-provider.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -462,12 +462,13 @@ export const FlowProvider = ({ children, flow }: Props) => {
462462
)
463463
})
464464

465-
if (
466-
numberOfYes.length === 1 &&
467-
connection.sourceHandle === sourceHandleYes
468-
) {
469-
return false
470-
}
465+
// if (
466+
// numberOfYes.length === 1 &&
467+
// connection.sourceHandle === sourceHandleYes
468+
// ) {
469+
// console.log('yes')
470+
// return false
471+
// }
471472

472473
if (
473474
numberOfNo.length === 1 &&

server/src/services/flows.service.ts

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class FlowService {
2020
constructor(
2121
@Inject(LOCALE_KEY) private readonly localeService: LocaleService,
2222
private readonly chanelService: ChannelService,
23-
) { }
23+
) {}
2424

2525
public async create(fields: TNewFlow) {
2626
const flowExisted = await db.query.flows.findFirst({
@@ -50,11 +50,13 @@ export class FlowService {
5050
label: 'Language',
5151
},
5252
],
53-
variables: [{
54-
name: 'lang',
55-
value: 'en',
56-
type: 'string',
57-
}]
53+
variables: [
54+
{
55+
name: 'language',
56+
value: 'en',
57+
type: 'string',
58+
},
59+
],
5860
})
5961
.returning()
6062

@@ -266,23 +268,17 @@ export class FlowService {
266268
return result
267269
}
268270
public async getFlowByContactId(contactId: string, isTest: boolean) {
269-
270-
const channel = await this.chanelService.findOneByContactId(contactId);
271-
let flow = null;
271+
const channel = await this.chanelService.findOneByContactId(contactId)
272+
let flow = null
272273

273274
if (isTest) {
274275
flow = await db.query.flows.findFirst({
275276
where: eq(flows.id, channel?.flowId),
276-
});
277-
278-
}
279-
else {
277+
})
278+
} else {
280279
flow = await db.query.flows.findFirst({
281-
where: and(
282-
eq(flows.id, channel?.flowId),
283-
isNotNull(flows.publishAt)
284-
),
285-
});
280+
where: and(eq(flows.id, channel?.flowId), isNotNull(flows.publishAt)),
281+
})
286282
}
287283

288284
if (!flow) {

0 commit comments

Comments
 (0)