File tree Expand file tree Collapse file tree 3 files changed +64
-1
lines changed Expand file tree Collapse file tree 3 files changed +64
-1
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @codebolt/codeboltjs" ,
3
- "version" : " 1.1.58 " ,
3
+ "version" : " 1.1.59 " ,
4
4
"description" : " " ,
5
5
"keywords" : [],
6
6
"author" : " " ,
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import debug from './modules/debug'
22
22
import tokenizer from './modules/tokenizer'
23
23
import WebSocket from 'ws' ;
24
24
import { EventEmitter } from 'events' ;
25
+ import { chatSummary } from './modules/history'
25
26
26
27
27
28
/**
@@ -89,6 +90,7 @@ class Codebolt { // Extend EventEmitter
89
90
vectordb = vectorDB ;
90
91
debug = debug ;
91
92
tokenizer = tokenizer ;
93
+ chatSummary = chatSummary
92
94
}
93
95
94
96
export default new Codebolt ( ) ;
Original file line number Diff line number Diff line change
1
+ import cbws from './websocket' ;
2
+
3
+ export enum logType {
4
+ info = "info" ,
5
+ error = "error" ,
6
+ warning = "warning"
7
+ }
8
+
9
+
10
+ export const chatSummary = {
11
+
12
+ summarizeAll : ( ) : Promise < {
13
+ role : string ;
14
+ content : string ;
15
+ } [ ] > => {
16
+ return new Promise ( ( resolve , reject ) => {
17
+ cbws . getWebsocket . send ( JSON . stringify ( {
18
+ "type" : "chatSummaryEvent" ,
19
+ "action" : "summarizeAll" ,
20
+
21
+ } ) ) ;
22
+ cbws . getWebsocket . on ( 'message' , ( data : string ) => {
23
+ const response = JSON . parse ( data ) ;
24
+ if ( response . type === "getSummarizeAllResponse" ) {
25
+ resolve ( response . payload ) ; // Resolve the Promise with the response data
26
+ }
27
+ } )
28
+ } )
29
+
30
+
31
+ } ,
32
+ summarize : ( messages : {
33
+ role : string ;
34
+ content : string ;
35
+ } [ ] , depth : number ) : Promise < {
36
+ role : string ;
37
+ content : string ;
38
+ } [ ] > => {
39
+ return new Promise ( ( resolve , reject ) => {
40
+ cbws . getWebsocket . send ( JSON . stringify ( {
41
+ "type" : "chatSummaryEvent" ,
42
+ "action" : "summarize" ,
43
+ messages,
44
+ depth
45
+ } ) ) ;
46
+ cbws . getWebsocket . on ( 'message' , ( data : string ) => {
47
+ const response = JSON . parse ( data ) ;
48
+ if ( response . type === "getSummarizeResponse" ) {
49
+ resolve ( response . payload ) ; // Resolve the Promise with the response data
50
+ }
51
+ } )
52
+ } )
53
+
54
+ }
55
+ }
56
+
57
+
58
+ export default debug ;
59
+
60
+
61
+
You can’t perform that action at this time.
0 commit comments