Skip to content

Commit d34ad12

Browse files
committed
Bugfix: hidden soruces as a attr of the widget
1 parent 2395417 commit d34ad12

File tree

9 files changed

+18
-4
lines changed

9 files changed

+18
-4
lines changed

BOOK_OF_FRUSTRATIONS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ This file is intended for writing down all those TODOs/tech. deb. you know it ne
1313
- [ ] Redo the stats after the RAG removal.
1414
- [ ] Widget: If the widget won't show the list of conversations due to a render attribute that hides them, then it shouldn't be requesting them.
1515
- [ ] SDK: Typify the MML from the context so it has its own secured method to access the different data structure inside MMLs as such 'content', 'knowledge_items', etc...
16+
- [ ] Widget: On the preview mode dummy messages we should be adding markup links and prefilled user feedback in other to have a more complete preview.

admin/components/widget_config/WidgetConfig.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
'only_chat',
3333
'start_small_mode',
3434
'start_with_history_closed',
35+
'hide_sources',
3536
'sources_first',
3637
'stick_input_prompt',
3738
'fit_to_parent'

doc/source/modules/widget/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ Next we will explain all the widget's possible parameters:
7373

7474
`customCss`: custom css to be applied to the widget.
7575

76+
`hideSources`: if the sources should be hidden, by default the sources will be displayed.
77+
7678
`sourcesFirst`: It will reverse the default order of the sources and the chat, so the message's references will be displayed first.
7779

7880
`startWithHistoryClosed`: if the widget starts with the history closed, by default the widget has the history opened.
@@ -136,6 +138,7 @@ The widget will intercept any message with the type `<MESSAGE_TYPE>` and will re
136138
lang: "es",
137139
previewMode: true,
138140
customCss: ":root { --chatfaq-color-primary-200: red; }",
141+
hideSources: true,
139142
sourcesFirst: true,
140143
startWithHistoryClosed: true,
141144
startSmallMode: true,
@@ -188,6 +191,7 @@ If you declare data attributes and a config object and its keys collide, then th
188191
data-lang="es"
189192
data-preview-mode
190193
data-custom-css=":root { --chatfaq-color-primary-200: red; }"
194+
data-hide-sources
191195
data-sources-first
192196
data-start-with-history-closed
193197
data-start-small-mode

widget/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ Next we will explain all the widget's possible parameters:
7373

7474
`customCss`: custom css to be applied to the widget.
7575

76+
`hideSources`: if the sources should be hidden, by default the sources will be displayed.
77+
7678
`sourcesFirst`: It will reverse the default order of the sources and the chat, so the message's references will be displayed first.
7779

7880
`startWithHistoryClosed`: if the widget starts with the history closed, by default the widget has the history opened.
@@ -136,6 +138,7 @@ The widget will intercept any message with the type `<MESSAGE_TYPE>` and will re
136138
lang: "es",
137139
previewMode: true,
138140
customCss: ":root { --chatfaq-color-primary-200: red; }",
141+
hideSources: true,
139142
sourcesFirst: true,
140143
startWithHistoryClosed: true,
141144
startSmallMode: true,
@@ -188,6 +191,7 @@ If you declare data attributes and a config object and its keys collide, then th
188191
data-lang="es"
189192
data-preview-mode
190193
data-custom-css=":root { --chatfaq-color-primary-200: red; }"
194+
data-hide-sources
191195
data-sources-first
192196
data-start-with-history-closed
193197
data-start-small-mode

widget/components/Widget.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ const props = defineProps({
6464
startWithHistoryClosed: Boolean,
6565
conversationId: String,
6666
widgetConfigId: String,
67+
hideSources: Boolean,
6768
sourcesFirst: Boolean,
6869
onlyChat: Boolean,
6970
fitToParent: Boolean,
@@ -135,6 +136,8 @@ function initStore() {
135136
136137
store.fullScreen = data.fullScreen
137138
store.sourcesFirst = data.sourcesFirst
139+
store.hideSources = data.hideSources
140+
138141
if (store.fullScreen) {
139142
store.opened = true
140143
store.maximized = false

widget/components/chat/msgs/ChatMsg.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<Message :data="layer" :is-last="isLastOfType && layersFinished" />
5555
</div>
5656
<References
57-
v-if="store.displaySources && props.message.stack && props.message.stack[0].payload?.references?.knowledge_items?.length && isLastOfType && (layersFinished || store.sourcesFirst)"
57+
v-if="!store.hideSources && props.message.stack && props.message.stack[0].payload?.references?.knowledge_items?.length && isLastOfType && (layersFinished || store.sourcesFirst)"
5858
:references="props.message.stack[0].payload.references"></References>
5959
</template>
6060
</div>

widget/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

widget/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "chatfaq-widget",
3-
"version": "0.1.10",
3+
"version": "0.1.11",
44
"private": false,
55
"main": "./dist/chatfaq-widget.umd.cjs",
66
"module": "./dist/chatfaq-widget.mjs",

widget/store/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const useGlobalStore = defineStore('globalStore', {
1515
historyOpened: true,
1616
fullScreen: false,
1717
sourcesFirst: false,
18+
hideSources: false,
1819
noHeader: false,
1920
previewMode: false,
2021
opened: false,

0 commit comments

Comments
 (0)