@quidgest/chatbot 0.6.2 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +12 -11
- package/dist/index.mjs +921 -889
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/ChatBot/ChatBot.vue +8 -2
- package/src/components/MarkdownRender/MarkdownRender.vue +39 -1
- package/src/components/MarkdownRender/__tests__/MarkdownRender.spec.ts +13 -0
- package/src/components/MarkdownRender/markdown-render.scss +44 -0
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
@charset "UTF-8";.markdown-renderer pre,.markdown-renderer code{white-space:pre-wrap;overflow-wrap:anywhere;overflow-x:auto}.markdown-renderer pre{position:relative;background-color:#f5f5f5;border:1px solid #e0e0e0;border-radius:6px;padding:.75rem 1rem;font-size:.875rem}.markdown-renderer code{padding:.2rem .4rem;border-radius:4px;font-size:.875rem}.markdown-renderer__execution-plan-content{background-color:var(--gray-dark);color:var(--q-theme-on-neutral-dark);padding:.75rem 1rem;border-radius:6px;margin-top:.5rem}.markdown-renderer__execution-plan-content ul,.markdown-renderer__execution-plan-content ol{margin:0;padding-left:1.5rem}.markdown-renderer__execution-plan-content p{margin:0}.markdown-renderer__execution-plan-content hr{border-color:var(--q-theme-on-neutral-dark)}.markdown-renderer__execution-progress-content{padding:.75rem 1rem;border-radius:6px;margin-top:.5rem}.markdown-renderer__execution-progress-content ul,.markdown-renderer__execution-progress-content ol{margin:0;padding-left:1.5rem}.markdown-renderer__execution-progress-content p{margin:0}.markdown-renderer__chat-summary-title{cursor:pointer;list-style:none;display:flex;align-items:center;gap:.5rem;font-weight:600}.markdown-renderer__chat-summary-title:before{content:"🔽";line-height:1}.markdown-renderer__chat-summary[open] .markdown-renderer__chat-summary-title:before{content:"🔼"}.markdown-renderer__chat-summary-title::marker{content:""}.markdown-renderer__chat-summary-title::-webkit-details-marker{display:none}.markdown-renderer__chat-summary-title p{margin:0}.markdown-renderer__chat-summary-content{padding:.5rem 0 0}.markdown-renderer__chat-summary-content ul,.markdown-renderer__chat-summary-content ol{margin:0;padding-left:1.5rem}.markdown-renderer__chat-summary-content p{margin:0}.q-field-preview{position:relative;display:flex;flex-direction:column;margin:1rem .25rem}.q-field-preview__toolbar{z-index:1;display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:.1rem .2rem}.q-field-preview__content{position:relative;background-color:#f5f5f5;border:1px solid #e0e0e0;border-radius:6px;padding:.75rem 1rem;font-size:.875rem}.q-field-preview__content.preserve-whitespace{white-space:pre-wrap}.q-field-preview__footer{display:flex;flex-direction:row;margin-top:.25rem}.q-field-preview:first-child{margin:0 1rem .25rem .25rem}.pulsing-dots{display:flex;align-items:center;justify-content:center;flex-direction:row;gap:.25rem}.generating-text{font-size:.9rem;color:var(--q-theme-primary)}.dots-container{display:flex;align-items:center;gap:.1rem}.dot{font-size:16px;line-height:1;animation:pulse 1s infinite;color:var(--q-theme-primary)}@keyframes pulse{0%,to{transform:scale(.8);opacity:.6}50%{transform:scale(1);opacity:1}}.q-chatbot__file-preview img,.q-chatbot__image-preview img{width:60px;height:60px;object-fit:cover;border-radius:4px;margin-right:.25rem;border:1px solid #eaebec;overflow:hidden}.q-chatbot__file-preview{display:inline-flex;align-items:center;position:relative;margin-top:.5rem;gap:.25rem;width:fit-content}.q-chatbot__file-preview img:focus{outline:solid rgb(var(--q-theme-info-rgb)/50%)}.q-chatbot__file-preview-container{display:flex;border-radius:.5rem;padding:.25rem .5rem;max-width:320px;align-items:center;justify-content:center;border:1px solid var(--q-theme-primary-light)}.q-chatbot__file-icon-container{display:flex;align-items:center;justify-content:center;border-radius:8px;width:36px;height:36px;flex-shrink:0;margin-right:10px;background:var(--q-theme-primary-light)}.q-chatbot__file-icon-container .q-icon{width:20px;height:20px}.q-chatbot__file-info{display:flex;flex-direction:column;overflow:hidden}.q-chatbot__file-name{font-size:12px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.q-chatbot__file-extension{font-size:10px}.q-chatbot{width:100%;height:100%;display:flex;flex-direction:column}.q-chatbot input{line-height:1.5rem}.q-chatbot .q-input-group .i-text__field{border-radius:0;flex:1}.q-chatbot__remove-file{position:absolute;top:-8px;right:-8px}.q-chatbot__text p{margin:0}.q-chatbot__content{background-color:#fff;border:1px solid #eaebec;height:100%;width:100%;display:flex;flex-direction:column;gap:.75rem;overflow:hidden}.q-chatbot__footer-container{padding:.8rem 0 0}.q-chatbot__input-wrapper{display:flex;flex-direction:column;position:relative}.q-chatbot .q-button.q-chatbot__remove-file{position:absolute;top:-5px;right:-5px;background-color:#00000080;color:#fff;border-radius:50%;padding:5px;font-size:10px;border:none}.q-chatbot .q-button.q-chatbot__remove-file:hover,.q-chatbot .q-button.q-chatbot__remove-file:focus{opacity:1;pointer-events:auto}.q-chatbot__send-container{padding-bottom:.25rem;display:flex;justify-content:space-between;width:100%}.q-chatbot__send-container .q-chatbot__send,.q-chatbot__send-container .q-chatbot__upload{border-radius:1rem}.q-chatbot__send-container .spacer{flex-grow:1}.q-chatbot__footer{position:sticky;padding:0 .5rem;border:1px solid #eaebec;border-radius:.25rem;bottom:0;width:100%;display:flex;flex-direction:column;gap:.25rem}.q-chatbot__footer-disabled{background-color:rgb(var(--q-theme-neutral-light-rgb)/25%);cursor:not-allowed}.q-chatbot__footer.drag-over{border:2px dashed rgb(var(--q-theme-primary-rgb)/25%);background-color:#018bd20d}.q-chatbot__footer .q-chatbot__input{min-height:50px;max-height:100px;border-bottom:1px solid #eaebec;overflow-y:auto}.q-chatbot__footer .q-text-area{max-height:100%;overflow-y:auto}.q-chatbot__footer .q-text-area .q-field__control{border:none}.q-chatbot__upload-container{display:flex;justify-content:flex-start;padding:.25rem 0}.q-chatbot__upload-container .q-chatbot__upload{border-radius:1rem}.q-chatbot__messages-container{display:flex;flex-direction:column;flex-grow:1;padding:0 1rem 2rem;gap:1.5rem;overflow-y:auto}.q-chatbot__messages-wrapper{display:flex;max-width:100%;gap:.2rem}.q-chatbot__tools{display:flex;flex-direction:row;justify-content:space-between;max-width:100%;padding:.25rem .5rem}.q-chatbot__message-wrapper{display:flex;flex-direction:column;gap:.2rem}.q-chatbot__message-container{display:flex;flex-direction:column;gap:.25rem}.q-chatbot__messages-wrapper_right{justify-content:flex-end}.q-chatbot__messages-wrapper_right .q-chatbot__message-container{align-items:flex-end}.q-chatbot__messages-wrapper_right .q-chatbot__message-wrapper{display:flex;align-items:flex-end}.q-chatbot__profile.q-icon__img{border-radius:50%;height:2rem;width:2rem}.q-chatbot__message{padding:.3rem .5rem;background-color:#eaebec;width:fit-content;min-height:2rem;white-space:normal;border-radius:0 .5rem .5rem}.q-chatbot__messages-wrapper_right .q-chatbot__message{background-color:#018bd233;border-radius:.5rem 0 .5rem .5rem;white-space:normal}.q-chatbot__sender{white-space:nowrap;color:#7c858d;font-size:.7rem}.q-chatbot__retry-button{align-items:center;display:flex}.q-chatbot__dialog-title{margin:.5rem 0}.hidden-input{display:none}
|
package/package.json
CHANGED
|
@@ -252,7 +252,12 @@
|
|
|
252
252
|
}
|
|
253
253
|
|
|
254
254
|
setDisabledState(false)
|
|
255
|
-
|
|
255
|
+
const hasChatSummary = data.history?.some((message) =>
|
|
256
|
+
message.content?.includes('data-type="chat-summary"')
|
|
257
|
+
)
|
|
258
|
+
if (!hasChatSummary) {
|
|
259
|
+
sendInitialMessage()
|
|
260
|
+
}
|
|
256
261
|
|
|
257
262
|
data.history.forEach(async (message: ChatBotMessageContent) => {
|
|
258
263
|
addChatMessage(
|
|
@@ -391,7 +396,8 @@
|
|
|
391
396
|
execution.callingTools = true
|
|
392
397
|
} else if (payload.event === 'tool_end') {
|
|
393
398
|
appendToolCompletion(msg, payload.data.html)
|
|
394
|
-
|
|
399
|
+
updateToolStatus(msg, texts.generatingResponse)
|
|
400
|
+
execution.callingTools = true
|
|
395
401
|
}
|
|
396
402
|
},
|
|
397
403
|
(error) => {
|
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
v-if="!isExecutionPlan && !isExecutionProgress"
|
|
3
|
+
v-if="!isExecutionPlan && !isExecutionProgress && !isChatSummary"
|
|
4
4
|
class="markdown-renderer"
|
|
5
5
|
v-html="renderedContent"></div>
|
|
6
|
+
<div
|
|
7
|
+
v-else-if="isChatSummary"
|
|
8
|
+
class="markdown-renderer">
|
|
9
|
+
<details class="markdown-renderer__chat-summary">
|
|
10
|
+
<summary
|
|
11
|
+
class="markdown-renderer__chat-summary-title"
|
|
12
|
+
v-html="chatSummaryTitle"></summary>
|
|
13
|
+
<div
|
|
14
|
+
v-if="chatSummaryContent"
|
|
15
|
+
class="markdown-renderer__chat-summary-content"
|
|
16
|
+
v-html="chatSummaryContent"></div>
|
|
17
|
+
</details>
|
|
18
|
+
</div>
|
|
6
19
|
<div
|
|
7
20
|
v-else-if="isExecutionPlan"
|
|
8
21
|
class="markdown-renderer">
|
|
@@ -47,6 +60,31 @@
|
|
|
47
60
|
return props.source.includes('data-type="execution-plan"')
|
|
48
61
|
})
|
|
49
62
|
|
|
63
|
+
const isChatSummary = computed(() => {
|
|
64
|
+
return props.source.includes('data-type="chat-summary"')
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
const chatSummaryTitle = computed(() => {
|
|
68
|
+
if (!isChatSummary.value) return ''
|
|
69
|
+
|
|
70
|
+
const lines = props.source.split(/\n|<br>/)
|
|
71
|
+
const titleLine = lines.find((line) => line.includes('data-type="chat-summary"'))
|
|
72
|
+
|
|
73
|
+
return md.value.render(titleLine || 'Conversation Summary')
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
const chatSummaryContent = computed(() => {
|
|
77
|
+
if (!isChatSummary.value) return ''
|
|
78
|
+
|
|
79
|
+
const lines = props.source.split(/\n|<br>/)
|
|
80
|
+
const titleIndex = lines.findIndex((line) => line.includes('data-type="chat-summary"'))
|
|
81
|
+
|
|
82
|
+
if (titleIndex === -1) return ''
|
|
83
|
+
|
|
84
|
+
const contentLines = lines.slice(titleIndex + 1).join('\n')
|
|
85
|
+
return md.value.render(contentLines)
|
|
86
|
+
})
|
|
87
|
+
|
|
50
88
|
const executionPlanTitle = computed(() => {
|
|
51
89
|
if (!isExecutionPlan.value) return ''
|
|
52
90
|
|
|
@@ -65,4 +65,17 @@ describe('MarkdownRender', () => {
|
|
|
65
65
|
expect(mockPlugin).toHaveBeenCalled()
|
|
66
66
|
expect(wrapper.props('plugins')).toHaveLength(1)
|
|
67
67
|
})
|
|
68
|
+
|
|
69
|
+
it('renders summary content inside a collapsed details element', () => {
|
|
70
|
+
const wrapper = mount(MarkdownRender, {
|
|
71
|
+
props: {
|
|
72
|
+
source: '<span data-type="chat-summary">**Conversation Summary**</span><br>Summary content'
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
const details = wrapper.find('details.markdown-renderer__chat-summary')
|
|
77
|
+
expect(details.exists()).toBe(true)
|
|
78
|
+
expect(details.attributes('open')).toBeUndefined()
|
|
79
|
+
expect(wrapper.find('summary.markdown-renderer__chat-summary-title').exists()).toBe(true)
|
|
80
|
+
})
|
|
68
81
|
})
|
|
@@ -58,4 +58,48 @@
|
|
|
58
58
|
margin: 0;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
+
|
|
62
|
+
&__chat-summary-title {
|
|
63
|
+
cursor: pointer;
|
|
64
|
+
list-style: none;
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
gap: 0.5rem;
|
|
68
|
+
font-weight: 600;
|
|
69
|
+
|
|
70
|
+
&::before {
|
|
71
|
+
content: '🔽';
|
|
72
|
+
line-height: 1;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.markdown-renderer__chat-summary[open] &::before {
|
|
76
|
+
content: '🔼';
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&::marker {
|
|
80
|
+
content: '';
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&::-webkit-details-marker {
|
|
84
|
+
display: none;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
p {
|
|
88
|
+
margin: 0;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&__chat-summary-content {
|
|
93
|
+
padding: 0.5rem 0 0;
|
|
94
|
+
|
|
95
|
+
ul,
|
|
96
|
+
ol {
|
|
97
|
+
margin: 0;
|
|
98
|
+
padding-left: 1.5rem;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
p {
|
|
102
|
+
margin: 0;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
61
105
|
}
|