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 11{
22 "name" : " @codebolt/codeboltjs" ,
3- "version" : " 1.1.58 " ,
3+ "version" : " 1.1.59 " ,
44 "description" : " " ,
55 "keywords" : [],
66 "author" : " " ,
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import debug from './modules/debug'
2222import tokenizer from './modules/tokenizer'
2323import WebSocket from 'ws' ;
2424import { EventEmitter } from 'events' ;
25+ import { chatSummary } from './modules/history'
2526
2627
2728/**
@@ -89,6 +90,7 @@ class Codebolt { // Extend EventEmitter
8990 vectordb = vectorDB ;
9091 debug = debug ;
9192 tokenizer = tokenizer ;
93+ chatSummary = chatSummary
9294}
9395
9496export 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