Skip to content

Commit

Permalink
Merge pull request #67 from Dialogue-Bot/DIAL-42-implement-test-your-bot
Browse files Browse the repository at this point in the history
feat: permit yes prompt, variable to connect to multiple node
  • Loading branch information
hi02102002 authored Apr 10, 2024
2 parents 53bb339 + 498b8cc commit 3537ea3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
3 changes: 3 additions & 0 deletions client/src/components/forms/variables-setting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ const stringifyVariableValue = (value: any, type: string) => {
.replace(/"/g, '')

if (type === 'object') return JSON.stringify(value, null, 2)

if (type === 'string') return JSON.stringify(value).replace(/"/g, '')

return JSON.stringify(value)
}

Expand Down
13 changes: 7 additions & 6 deletions client/src/components/pages/flow-detail/flow-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -462,12 +462,13 @@ export const FlowProvider = ({ children, flow }: Props) => {
)
})

if (
numberOfYes.length === 1 &&
connection.sourceHandle === sourceHandleYes
) {
return false
}
// if (
// numberOfYes.length === 1 &&
// connection.sourceHandle === sourceHandleYes
// ) {
// console.log('yes')
// return false
// }

if (
numberOfNo.length === 1 &&
Expand Down
32 changes: 14 additions & 18 deletions server/src/services/flows.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class FlowService {
constructor(
@Inject(LOCALE_KEY) private readonly localeService: LocaleService,
private readonly chanelService: ChannelService,
) { }
) {}

public async create(fields: TNewFlow) {
const flowExisted = await db.query.flows.findFirst({
Expand Down Expand Up @@ -50,11 +50,13 @@ export class FlowService {
label: 'Language',
},
],
variables: [{
name: 'lang',
value: 'en',
type: 'string',
}]
variables: [
{
name: 'language',
value: 'en',
type: 'string',
},
],
})
.returning()

Expand Down Expand Up @@ -266,23 +268,17 @@ export class FlowService {
return result
}
public async getFlowByContactId(contactId: string, isTest: boolean) {

const channel = await this.chanelService.findOneByContactId(contactId);
let flow = null;
const channel = await this.chanelService.findOneByContactId(contactId)
let flow = null

if (isTest) {
flow = await db.query.flows.findFirst({
where: eq(flows.id, channel?.flowId),
});

}
else {
})
} else {
flow = await db.query.flows.findFirst({
where: and(
eq(flows.id, channel?.flowId),
isNotNull(flows.publishAt)
),
});
where: and(eq(flows.id, channel?.flowId), isNotNull(flows.publishAt)),
})
}

if (!flow) {
Expand Down

0 comments on commit 3537ea3

Please sign in to comment.