Skip to content

Commit

Permalink
feat(plugin-flow-builder): create message with feedback when using th…
Browse files Browse the repository at this point in the history
…e knowledge base
  • Loading branch information
Iru89 committed Jul 1, 2024
1 parent fac03fc commit 8d90eb7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,17 @@ async function getContentsWithKnowledgeResponse(
return undefined
}

return updateContentsWithAnswer(contents, knowledgeBaseResponse.answer)
return updateContentsWithResponse(contents, knowledgeBaseResponse)
}

function updateContentsWithAnswer(
function updateContentsWithResponse(
contents: FlowContent[],
answer: string
response: KnowledgeBaseResponse
): FlowContent[] {
return contents.map(content => {
if (content instanceof FlowKnowledgeBase) {
content.text = answer
content.text = response.answer
content.inferenceId = response.inferenceId
}

return content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import { ContentFieldsBase } from './content-fields-base'
import { HtKnowledgeBaseNode } from './hubtype-fields'

export class FlowKnowledgeBase extends ContentFieldsBase {
public code = ''
public code: string = ''
public sources: string[] = []
public text = ''
public text: string = ''
public inferenceId?: string

static fromHubtypeCMS(component: HtKnowledgeBaseNode): FlowKnowledgeBase {
const newKnowledgeBase = new FlowKnowledgeBase(component.id)
Expand All @@ -18,6 +19,10 @@ export class FlowKnowledgeBase extends ContentFieldsBase {
}

toBotonic(id: string): JSX.Element {
return <Text key={id}>{this.text}</Text>
return (

Check warning on line 22 in packages/botonic-plugin-flow-builder/src/content-fields/flow-knowledge-base.tsx

View check run for this annotation

Codecov / codecov/patch

packages/botonic-plugin-flow-builder/src/content-fields/flow-knowledge-base.tsx#L22

Added line #L22 was not covered by tests
<Text key={id} withfeedback={true} inferenceid={this.inferenceId}>
{this.text}
</Text>
)
}
}

0 comments on commit 8d90eb7

Please sign in to comment.