File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -96,7 +96,15 @@ export class PatternModel implements LanguageModelV1 {
9696 * TODO: Re-enable reasoning when backend supports it
9797 * https://github.com/pattern-tech/pattern-app/issues/27
9898 */
99- } else if ( event . type === 'completion' ) {
99+ } else if (
100+ event . type === 'completion' ||
101+ event . type === 'heartbeat'
102+ ) {
103+ /**
104+ * Ignore heartbeat and completion events. Completion event is
105+ * identified automatically when the stream is ended, and the
106+ * heartbeat event is only for keeping the connection alive
107+ */
100108 } else {
101109 controller . enqueue ( {
102110 type : 'error' ,
Original file line number Diff line number Diff line change @@ -14,10 +14,16 @@ export interface CompletionEvent {
1414 data : 'Stream completed' ;
1515}
1616
17+ export interface HeartbeatEvent {
18+ type : 'heartbeat' ;
19+ data : 'still_processing' ;
20+ }
21+
1722export type PatternStreamingResponseEvent =
1823 | TokenEvent
1924 | ToolStartEvent
20- | CompletionEvent ;
25+ | CompletionEvent
26+ | HeartbeatEvent ;
2127
2228export interface PatternProviderMetadata {
2329 accessToken : string ;
You can’t perform that action at this time.
0 commit comments