Skip to content

Commit 804a523

Browse files
author
vikasrohit
authored
Merge pull request #1232 from appirio-tech/feature/generic_chatbot_project_type
Feature/generic chatbot project type
2 parents de0c30e + 07d838c commit 804a523

File tree

6 files changed

+247
-8
lines changed

6 files changed

+247
-8
lines changed
Lines changed: 28 additions & 0 deletions
Loading
Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
import _ from 'lodash'
2+
// import { Icons } from 'appirio-tech-react-components'
3+
import { findProduct} from '../projectWizard'
4+
5+
const isFileRequired = (project, subSections) => {
6+
const subSection = _.find(subSections, (s) => s.type === 'questions')
7+
const fields = _.filter(subSection.questions, q => q.type.indexOf('see-attached') > -1)
8+
// iterate over all seeAttached type fields to check
9+
// if any see attached is checked.
10+
return _.some(_.map(
11+
_.map(fields, 'fieldName'),
12+
fn => _.get(project, `${fn}.seeAttached`)
13+
))
14+
}
15+
16+
const sections = [
17+
{
18+
id: 'appDefinition',
19+
title: (project, showProduct) => {
20+
const product = _.get(project, 'details.products[0]')
21+
if (showProduct && product) {
22+
const prd = findProduct(product)
23+
if (prd) return prd
24+
}
25+
return 'Definition'
26+
},
27+
required: true,
28+
description: 'Please answer a few basic questions about your project. You can also provide the needed information in a supporting document--add a link in the notes section or upload it below.',
29+
subSections: [
30+
{
31+
id: 'projectName',
32+
required: true,
33+
validationError: 'Please provide a name for your project',
34+
fieldName: 'name',
35+
description: '',
36+
title: 'Project Name',
37+
type: 'project-name'
38+
},
39+
{
40+
id: 'questions',
41+
required: true,
42+
hideTitle: true,
43+
title: 'Questions',
44+
description: '',
45+
type: 'questions',
46+
questions: [
47+
{
48+
id: 'projectInfo',
49+
fieldName: 'description',
50+
description: 'Brief Description',
51+
title: 'Description',
52+
type: 'textbox'
53+
},
54+
{
55+
icon: 'question',
56+
title: 'What capabilities does the chatbot need to support?',
57+
description: '',
58+
type: 'checkbox-group',
59+
fieldName: 'details.appDefinition.capabilities',
60+
options: [
61+
{value: 'order_management', label: 'Order Management'},
62+
{value: 'information', label: 'Information'},
63+
{value: 'help', label: 'Help'},
64+
{value: 'complaints', label: 'Complaints'},
65+
{value: 'billing', label: 'Billing'},
66+
{value: 'account_management', label: 'Account Management'},
67+
{value: 'custom', label: 'Custom (please explain in the Notes)'}
68+
]
69+
},
70+
{
71+
icon: 'question',
72+
title: 'Will the chatbot need to access data from any systems to support the capabilities you listed above? If so, please list the systems below.',
73+
description: '',
74+
type: 'textbox',
75+
fieldName: 'details.appDefinition.integrationSystems'
76+
},
77+
{
78+
icon: 'question',
79+
title: 'Do you have any example agent conversations you can provide? If so, please paste them or any links to documents below (you’ll be able to upload documents later).',
80+
description: '',
81+
type: 'textbox',
82+
fieldName: 'details.appDefinition.existingAgentScripts'
83+
},
84+
{
85+
icon: 'question',
86+
title: 'Are you planning to transfer conversations to human agents? If so, please list the agents’ communication tools (e.g., Slack, LiveAgent, Intercom, etc.).',
87+
description: '',
88+
type: 'textbox',
89+
fieldName: 'details.appDefinition.transferToHumanAgents'
90+
}
91+
]
92+
},
93+
{
94+
id: 'notes',
95+
fieldName: 'details.appDefinition.notes',
96+
title: 'Notes',
97+
description: 'Add any other important information regarding your project (e.g., links to documents or existing applications, budget or timing constraints)',
98+
type: 'notes'
99+
},
100+
{
101+
id: 'files',
102+
required: isFileRequired,
103+
title: (project) => `Project Files (${_.get(project, 'attachments', []).length})` || 'Files',
104+
description: '',
105+
type: 'files',
106+
fieldName: 'attachments'
107+
}
108+
]
109+
}
110+
]
111+
112+
export default sections
113+
114+
export const basicSections = [
115+
{
116+
id: 'appDefinition',
117+
title: '',
118+
required: true,
119+
description: 'Please answer a few basic questions about your project and, as an option, add links to supporting documents in the “Notes” section. If you have any files to upload, you’ll be able to do so later.',
120+
subSections: [
121+
{
122+
id: 'projectName',
123+
required: true,
124+
validationError: 'Please provide a name for your project',
125+
fieldName: 'name',
126+
description: '',
127+
title: 'Project Name',
128+
type: 'project-name'
129+
},
130+
{
131+
id: 'questions',
132+
required: true,
133+
hideTitle: true,
134+
title: 'Questions',
135+
description: '',
136+
type: 'questions',
137+
questions: [
138+
{
139+
id: 'projectInfo',
140+
required: true,
141+
fieldName: 'description',
142+
validationError: 'Please provide a description',
143+
description: 'Brief Description',
144+
title: 'Description',
145+
type: 'textbox'
146+
},
147+
{
148+
icon: 'question',
149+
required: true,
150+
validationError: 'Please complete this section',
151+
title: 'What capabilities does the chatbot need to support?',
152+
description: '',
153+
type: 'checkbox-group',
154+
fieldName: 'details.appDefinition.capabilities',
155+
options: [
156+
{value: 'order_management', label: 'Order management'},
157+
{value: 'information', label: 'Information'},
158+
{value: 'help', label: 'Help'},
159+
{value: 'complaints', label: 'Complaints'},
160+
{value: 'billing', label: 'Billing'},
161+
{value: 'account_management', label: 'Account management'},
162+
{value: 'custom', label: 'Custom (please explain in the Notes)'}
163+
]
164+
},
165+
{
166+
icon: 'question',
167+
required: true,
168+
validationError: 'Please complete this section',
169+
title: 'Will the chatbot need to access data from any systems to support the capabilities you listed above? If so, please list the systems below.',
170+
description: '',
171+
type: 'textbox',
172+
fieldName: 'details.appDefinition.integrationSystems'
173+
},
174+
{
175+
icon: 'question',
176+
required: true,
177+
validationError: 'Please complete this section',
178+
title: 'Do you have any example agent conversations you can provide? If so, please paste them or any links to documents below (you’ll be able to upload documents later).',
179+
description: '',
180+
type: 'textbox',
181+
fieldName: 'details.appDefinition.existingAgentScripts'
182+
},
183+
{
184+
icon: 'question',
185+
required: true,
186+
validationError: 'Please complete this section',
187+
title: 'Are you planning to transfer conversations to human agents? If so, please list the agents’ communication tools (e.g., Slack, LiveAgent, Intercom, etc.).',
188+
description: '',
189+
type: 'textbox',
190+
fieldName: 'details.appDefinition.transferToHumanAgents'
191+
}
192+
]
193+
},
194+
{
195+
id: 'notes',
196+
fieldName: 'details.appDefinition.notes',
197+
title: 'Notes',
198+
description: 'Add any other important information regarding your project (e.g., links to documents or existing applications, budget or timing constraints)',
199+
type: 'notes'
200+
}
201+
]
202+
}
203+
]

src/config/projectSpecification/typeToSpecification.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"website_development": "app_dev.v1.0",
99
"application_development": "app_dev.v1.0",
1010
"watson_chatbot": "ibm_chatbot.v1.0",
11+
"generic_chatbot": "generic_chatbot.v1.0",
1112
"generic_dev": "app_dev.v1.0",
1213
"real_world_testing": "real_world_testing.v1.0",
1314
"mobility_testing": "app_dev.v1.0",

src/config/projectWizard/index.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,22 @@ const products = {
3232
},
3333
Chatbot: {
3434
icon: 'product-cat-chatbot',
35-
info: 'Build a cognitive chat bot for your product',
35+
info: 'Build, train and test a custom conversation for your chatbot',
3636
question: 'What do you need to develop?',
3737
id: 'chatbot',
38-
hidden: true,
3938
subtypes: {
4039
'Watson Chatbot': {
4140
brief: 'Watson Chatbot',
4241
details: 'Build Chatbot using IBM Watson',
42+
icon: 'product-chatbot-watson',
43+
id: 'watson_chatbot',
44+
hidden: true
45+
},
46+
Chatbot: {
47+
brief: 'Chatbot',
48+
details: 'Build, train and test a custom conversation for your chat bot',
4349
icon: 'product-chatbot-chatbot',
44-
id: 'watson_chatbot'
50+
id: 'generic_chatbot'
4551
}
4652
}
4753
},
@@ -196,12 +202,13 @@ export function findCategory(categoryId) {
196202
return null
197203
}
198204

199-
export function findProductsOfCategory(category) {
205+
export function findProductsOfCategory(category, fetchHidden = true) {
200206
for(const pType in products) {
201207
if (products[pType].id === category) {
202208
const ret = []
203209
for(const prd in products[pType].subtypes) {
204-
if (!products[pType].subtypes[prd].disabled) {
210+
const product = products[pType].subtypes[prd]
211+
if (!product.disabled && (fetchHidden || !product.hidden)) {
205212
ret.push({ ...products[pType].subtypes[prd], name: prd })
206213
}
207214
}

src/projects/create/components/ProjectWizard.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ class ProjectWizard extends Component {
160160
updateProjectType(projectType) {
161161
window.scrollTo(0, 0)
162162
const { onStepChange, onProjectUpdate } = this.props
163-
const products = findProductsOfCategory(projectType)
163+
const products = findProductsOfCategory(projectType, false)
164164
const updateQuery = { }
165165
// restore common fields from dirty project
166166
// this.restoreCommonDetails(products, updateQuery, detailsQuery)
@@ -287,7 +287,7 @@ class ProjectWizard extends Component {
287287

288288
handleStepChange(wizardStep) {
289289
const { onStepChange } = this.props
290-
const products = findProductsOfCategory(this.state.project.type)
290+
const products = findProductsOfCategory(this.state.project.type, false)
291291
// if project type has only one product, move one step back to select project type step
292292
if (wizardStep === WZ_STEP_SELECT_PROD_TYPE && products && products.length === 1) {
293293
wizardStep = WZ_STEP_SELECT_PROJ_TYPE

src/projects/create/components/SelectProjectType.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function SelectProjectType(props) {
1414
for (const key in config) {
1515
const item = config[key]
1616
const icon = <SVGIconImage filePath={item.icon} />
17-
const products = findProductsOfCategory(item.id) || []
17+
const products = findProductsOfCategory(item.id, false) || []
1818
// don't render disabled items for selection
1919
// don't render hidden items as well, hidden items can be reached via direct link though
2020
if (item.disabled || item.hidden) continue

0 commit comments

Comments
 (0)