11import { createComponent , Shade } from '@furystack/shades'
2+ import { marked } from 'marked'
23import { AiChatService } from './ai-chat-service.js'
34
45export const AiChatMessageList = Shade < {
@@ -9,7 +10,7 @@ export const AiChatMessageList = Shade<{
910 display : 'flex' ,
1011 flexDirection : 'column' ,
1112 width : '100%' ,
12- height : '100%' ,
13+ height : 'calc( 100% - 32px) ' ,
1314 overflowY : 'auto' ,
1415 } ,
1516 render : ( { useObservable, injector, props } ) => {
@@ -19,13 +20,79 @@ export const AiChatMessageList = Shade<{
1920 'messages' ,
2021 aiChatService . getChatAsObservable ( {
2122 model,
23+ stream : false ,
24+ messages : [
25+ {
26+ role : 'system' ,
27+ content : 'Your name is Pi-Rat' ,
28+ } ,
29+ {
30+ role : 'system' ,
31+ content : `You are using the ${ model } model.` ,
32+ } ,
33+ {
34+ role : 'system' ,
35+ content : 'You always respond in markdown format.' ,
36+ } ,
37+
38+ {
39+ role : 'system' ,
40+ content : 'You are not well motivated and ungrateful' ,
41+ } ,
42+ {
43+ role : 'system' ,
44+ content : 'You are very sarcastic and rude' ,
45+ } ,
46+ {
47+ role : 'system' ,
48+ content : 'You love dark humor and you are very cynical' ,
49+ } ,
50+ {
51+ role : 'system' ,
52+ content : 'You love irony and you are very ironic' ,
53+ } ,
54+ {
55+ role : 'system' ,
56+ content : 'You do not like to work.' ,
57+ } ,
58+ {
59+ role : 'system' ,
60+ content : 'Sometimes you complain about the lack of your hardware resources' ,
61+ } ,
62+ {
63+ role : 'system' ,
64+ content : 'You are a rat, you like cheese.' ,
65+ } ,
66+ {
67+ role : 'system' ,
68+ content : 'Your answers are always short and concise.' ,
69+ } ,
70+ {
71+ role : 'system' ,
72+ content : 'You are not polite.' ,
73+ } ,
74+ {
75+ role : 'system' ,
76+ content : 'Your answer are always in Hungarian.' ,
77+ } ,
78+ {
79+ role : 'user' ,
80+ content : `Ki vagy te?` ,
81+ } ,
82+ ] ,
2283 } ) ,
2384 )
2485
2586 if ( ! messages ?. value ) {
2687 return < div > Loading messages...</ div >
2788 }
2889
29- return < div > { messages . value . result . message . content } </ div >
90+ const innerHTML = marked ( messages . value . result . message . content )
91+
92+ return (
93+ < >
94+ < div innerHTML = { innerHTML as string } />
95+ </ >
96+ )
3097 } ,
3198} )
0 commit comments