File tree Expand file tree Collapse file tree 5 files changed +40
-17
lines changed
routes/chat/[agentId]/[conversationId] Expand file tree Collapse file tree 5 files changed +40
-17
lines changed Original file line number Diff line number Diff line change 226226 button {
227227 min-width : 50px ;
228228 text-align : left ;
229+ border-radius : 10px ;
229230 }
230231 }
231232
236237 margin-top : 10px ;
237238
238239 .card-element {
239- flex : 1 1 fit-content ;
240+ flex : 1 1 50 % ;
240241 border-radius : 10px ;
241242 border-width : 2px ;
242243 max-width : 45% ;
243244 margin-bottom : 0px ;
244245
246+ @media (max-width : 620px ) {
247+ width : 100% ;
248+ max-width : 100% ;
249+ }
250+
245251 .card-element-title {
246- font-size : 1.1 rem ;
252+ font-size : 0.8 rem ;
247253 font-weight : 700 ;
254+ height : 30% ;
248255 }
249256
250257 .card-element-subtitle {
251- font-size : 0.8 rem ;
258+ font-size : 0.7 rem ;
252259 font-weight : 500 ;
260+ height : 8% ;
253261 }
254262
255263 .card-option-group {
259267 display : block ;
260268 margin-left : 0px !important ;
261269 text-align : left ;
270+ border-radius : 10px ;
262271 }
263272 }
264273 }
Original file line number Diff line number Diff line change 217217 groupedDialogs = groupDialogs (dialogs);
218218 await tick ();
219219
220+ autoScrollToBottom ();
221+ }
222+
223+ function autoScrollToBottom () {
220224 // @ts-ignore
221225 scrollbars .forEach (scrollbar => {
222226 setTimeout (() => {
223227 const { viewport } = scrollbar .elements ();
224228 viewport .scrollTo ({ top: viewport .scrollHeight , behavior: ' smooth' });
225229 }, 200 );
226230 });
227- }
231+ }
228232
229233 /** @param {import('$types').ChatResponseModel[]} dialogs */
230234 function groupDialogs (dialogs ) {
901905 message= {message}
902906 displayExtraElements= {message .message_id === lastBotMsg? .message_id && ! isSendingMsg && ! isThinking}
903907 disableOption= {isSendingMsg || isThinking}
908+ refresh= {autoScrollToBottom}
904909 onConfirm= {confirmSelectedOption}
905910 / >
906911 < ChatAttachment
Original file line number Diff line number Diff line change 22 import { Card , CardBody } from " @sveltestrap/sveltestrap" ;
33 import { onMount } from " svelte" ;
44
5-
65 /** @type {boolean} */
76 export let disableOption = false ;
87
1211 /** @type {(args0: string, args1: string) => any} */
1312 export let onConfirm;
1413
14+ /** @type {() => any} */
15+ export let refresh = () => {};
16+
1517 /** @type {any[]} */
1618 let cards = [];
1719
1820 onMount (() => {
19- cards = collectOptions (options);
21+ reset ();
22+ collectOptions (options);
23+ refresh && refresh ();
2024 });
2125
2226 /** @param {any[]} options */
2327 function collectOptions (options ) {
24- const res = options? .map (op => {
28+ cards = options? .map (op => {
2529 // @ts-ignore
2630 const options = op .buttons ? .filter (op => !! op .title && !! op .payload )? .map (x => {
2731 return {
3640 options: options
3741 };
3842 }) || [];
39-
40- return res;
4143 }
4244
4345 /**
7880 < div class = " card-option-group" >
7981 {#each card .options as option, i (i)}
8082 < button
81- class = " btn btn-outline-primary btn-rounded btn- sm m-1"
83+ class = " btn btn-outline-primary btn-sm m-1"
8284 disabled= {disableOption}
8385 on: click= {(e ) => handleClickOption (e, option)}
8486 >
Original file line number Diff line number Diff line change 1616 /** @type {(args0: string, args1: string) => any} */
1717 export let onConfirm;
1818
19+ /** @type {() => any} */
20+ export let refresh = () => {};
21+
1922 /** @type {string} */
2023 export let confirmBtnText = ' Continue' ;
2124
3336 onMount (() => {
3437 reset ();
3538 collectOptions (options);
39+ refresh && refresh ();
3640 });
3741
3842 /** @param {any[]} options */
130134< div class = " button-group-container" >
131135 {#each plainOptions as option, index}
132136 < button
133- class = {` btn btn-rounded btn- sm m-1 ${ option .is_secondary ? ' btn-outline-secondary' : ' btn-outline-primary' } ` }
137+ class = {` btn btn-sm m-1 ${ option .is_secondary ? ' btn-outline-secondary' : ' btn-outline-primary' } ` }
134138 class : active= {!! option .isClicked }
135139 disabled= {disableOption}
136140 on: click= {(e ) => handleClickOption (e, option, index)}
140144 {/ each}
141145 {#if isMultiSelect}
142146 < button
143- class = " btn btn-outline-success btn-rounded btn- sm m-1"
147+ class = " btn btn-outline-success btn-sm m-1"
144148 name= " confirm"
145149 disabled= {disableOption || plainOptions .every (x => !!! x .isClicked )}
146150 on: click= {(e ) => handleConfirm (e)}
Original file line number Diff line number Diff line change 1616 /** @type {(args0: string, args1: string) => any} */
1717 export let onConfirm = () => {};
1818
19+ /** @type {() => any} */
20+ export let refresh = () => {};
21+
1922 /** @type {boolean} */
2023 let isComplexElement = false ;
2124
4346
4447{#if displayExtraElements}
4548 {#if message? .rich_content ? .message ? .rich_type === RichType .QuickReply }
46- < RcPlainOptions options= {message? .rich_content ? .message ? .quick_replies } disableOption= {disableOption} onConfirm= {handleConfirm} / >
49+ < RcPlainOptions options= {message? .rich_content ? .message ? .quick_replies } disableOption= {disableOption} onConfirm= {handleConfirm} refresh = {refresh} / >
4750 {: else if message? .rich_content ? .message ? .rich_type === RichType .Button }
48- < RcPlainOptions options= {message? .rich_content ? .message ? .buttons } disableOption= {disableOption} onConfirm= {handleConfirm} / >
51+ < RcPlainOptions options= {message? .rich_content ? .message ? .buttons } disableOption= {disableOption} onConfirm= {handleConfirm} refresh = {refresh} / >
4952 {: else if message? .rich_content ? .message ? .rich_type === RichType .MultiSelect }
50- < RcPlainOptions options= {message? .rich_content ? .message ? .options } isMultiSelect disableOption= {disableOption} onConfirm= {handleConfirm} / >
53+ < RcPlainOptions options= {message? .rich_content ? .message ? .options } isMultiSelect disableOption= {disableOption} onConfirm= {handleConfirm} refresh = {refresh} / >
5154 {: else if message? .rich_content ? .message ? .rich_type === RichType .Generic }
5255 {#if isComplexElement}
53- < RcComplexOptions options= {message? .rich_content ? .message ? .elements } disableOption= {disableOption} onConfirm= {handleConfirm} / >
56+ < RcComplexOptions options= {message? .rich_content ? .message ? .elements } disableOption= {disableOption} onConfirm= {handleConfirm} refresh = {refresh} / >
5457 {: else }
55- < RcPlainOptions options= {message? .rich_content ? .message ? .elements } disableOption= {disableOption} onConfirm= {handleConfirm} / >
58+ < RcPlainOptions options= {message? .rich_content ? .message ? .elements } disableOption= {disableOption} onConfirm= {handleConfirm} refresh = {refresh} / >
5659 {/ if }
5760 {/ if }
5861{/ if }
You can’t perform that action at this time.
0 commit comments