-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update follow up questions for DI
- Loading branch information
Shibani Basava
authored and
Shibani Basava
committed
Feb 13, 2024
1 parent
a7840b3
commit 628065d
Showing
7 changed files
with
93 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
packages/chat-component/src/components/follow-up-questions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { injectable } from 'inversify'; | ||
import { | ||
container, | ||
type ChatEntryInlineInputController, | ||
ControllerType, | ||
ComposableReactiveControllerBase, | ||
} from './composable.js'; | ||
import { html } from 'lit'; | ||
import { unsafeSVG } from 'lit/directives/unsafe-svg.js'; | ||
import iconQuestion from '../../public/svg/bubblequestion-icon.svg?raw'; | ||
|
||
@injectable() | ||
export class FollowupQuestionsController | ||
extends ComposableReactiveControllerBase | ||
implements ChatEntryInlineInputController | ||
{ | ||
render(entry: ChatThreadEntry, handleInput: (input: string) => void) { | ||
const followupQuestions = entry.followupQuestions; | ||
// render followup questions | ||
// need to fix first after decoupling of teaserlist | ||
if (followupQuestions && followupQuestions.length > 0) { | ||
return html` | ||
<div class="items__listWrapper"> | ||
${unsafeSVG(iconQuestion)} | ||
<ul class="items__list followup"> | ||
${followupQuestions.map( | ||
(followupQuestion) => html` | ||
<li class="items__listItem--followup"> | ||
<a | ||
class="items__link" | ||
href="#" | ||
data-testid="followUpQuestion" | ||
@click="${() => handleInput(followupQuestion)}" | ||
>${followupQuestion}</a | ||
> | ||
</li> | ||
`, | ||
)} | ||
</ul> | ||
</div> | ||
`; | ||
} | ||
|
||
return ''; | ||
} | ||
} | ||
|
||
container.bind<ChatEntryInlineInputController>(ControllerType.ChatEntryInlineInput).to(FollowupQuestionsController); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters