File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed
ai-assistant/src/core/prompt Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -11,15 +11,31 @@ export class Prompt {
1111 this . _messages = messages ;
1212 }
1313
14+ private parsePromptContent ( content : string ) : string {
15+ return content
16+ . split ( "\n" )
17+ . map ( ( x ) => x . trim ( ) )
18+ . join ( "\n" ) ;
19+ }
20+
1421 pushSystem ( content : string ) {
15- this . _messages . push ( { role : "system" , content } ) ;
22+ this . _messages . push ( {
23+ role : "system" ,
24+ content : this . parsePromptContent ( content ) ,
25+ } ) ;
1626 }
1727
1828 pushAssistant ( content : string ) {
19- this . _messages . push ( { role : "assistant" , content } ) ;
29+ this . _messages . push ( {
30+ role : "assistant" ,
31+ content : this . parsePromptContent ( content ) ,
32+ } ) ;
2033 }
2134
2235 pushUser ( content : string ) {
23- this . _messages . push ( { role : "user" , content } ) ;
36+ this . _messages . push ( {
37+ role : "user" ,
38+ content : this . parsePromptContent ( content ) ,
39+ } ) ;
2440 }
2541}
You can’t perform that action at this time.
0 commit comments