File tree 2 files changed +40
-0
lines changed
src/backend/src/modules/puterai
2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ const BaseService = require ( "../../services/BaseService" ) ;
2
+
3
+ class FakeChatService extends BaseService {
4
+ static IMPLEMENTS = {
5
+ [ 'puter-chat-completion' ] : {
6
+ async list ( ) {
7
+ return [ 'fake' ] ;
8
+ } ,
9
+ async complete ( { messages, stream, model } ) {
10
+ return {
11
+ message : {
12
+ "id" : "00000000-0000-0000-0000-000000000000" ,
13
+ "type" : "message" ,
14
+ "role" : "assistant" ,
15
+ "model" : "fake" ,
16
+ "content" : [
17
+ {
18
+ "type" : "text" ,
19
+ "text" : "I am a fake AI, I don't know how to respond to anything."
20
+ }
21
+ ] ,
22
+ "stop_reason" : "end_turn" ,
23
+ "stop_sequence" : null ,
24
+ "usage" : {
25
+ "input_tokens" : 0 ,
26
+ "output_tokens" : 1
27
+ }
28
+ }
29
+ }
30
+ }
31
+ }
32
+ }
33
+ }
34
+
35
+ module . exports = {
36
+ FakeChatService,
37
+ } ;
Original file line number Diff line number Diff line change @@ -53,6 +53,9 @@ class PuterAIModule extends AdvancedBase {
53
53
const { XAIService } = require ( './XAIService' ) ;
54
54
services . registerService ( 'xai' , XAIService ) ;
55
55
}
56
+
57
+ const { FakeChatService } = require ( './FakeChatService' ) ;
58
+ services . registerService ( 'fake-chat' , FakeChatService ) ;
56
59
}
57
60
}
58
61
You can’t perform that action at this time.
0 commit comments