File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ export interface ParserCallbacks {
29
29
onArtifactClose ?: ArtifactCallback ;
30
30
onActionOpen ?: ActionCallback ;
31
31
onActionClose ?: ActionCallback ;
32
+ onReceivedActionContent ?: ActionCallback ;
32
33
}
33
34
34
35
interface ElementFactoryProps {
@@ -99,6 +100,14 @@ export class StreamingMessageParser {
99
100
100
101
currentAction . content = content ;
101
102
103
+
104
+ this . _options . callbacks ?. onReceivedActionContent ?.( {
105
+ artifactId : currentArtifact . id ,
106
+ messageId,
107
+ actionId : String ( state . actionId - 1 ) ,
108
+ action : currentAction as BoltAction ,
109
+ } ) ;
110
+
102
111
this . _options . callbacks ?. onActionClose ?.( {
103
112
artifactId : currentArtifact . id ,
104
113
messageId,
@@ -118,6 +127,18 @@ export class StreamingMessageParser {
118
127
119
128
i = closeIndex + ARTIFACT_ACTION_TAG_CLOSE . length ;
120
129
} else {
130
+
131
+ const content = input . slice ( i , input . length - ARTIFACT_ACTION_TAG_CLOSE . length ) ;
132
+
133
+ this . _options . callbacks ?. onReceivedActionContent ?.( {
134
+ artifactId : currentArtifact . id ,
135
+ messageId,
136
+ actionId : String ( state . actionId - 1 ) ,
137
+ action : {
138
+ ...currentAction ,
139
+ content,
140
+ } as BoltAction ,
141
+ } ) ;
121
142
break ;
122
143
}
123
144
} else {
You can’t perform that action at this time.
0 commit comments