()
| 39 | } |
| 40 | |
| 41 | function guiMain() { |
| 42 | // Register builtin views. |
| 43 | serviceManager.registerView(MultiChatsView); |
| 44 | serviceManager.registerView(ChatView); |
| 45 | |
| 46 | // Register builtin services. |
| 47 | const chatServiceParams: Param[] = [ |
| 48 | { |
| 49 | name: 'tools', |
| 50 | type: 'multi-selection', |
| 51 | displayName: 'Tools', |
| 52 | selections: () => toolManager.getToolSelections(), |
| 53 | title: 'Install extensions...', |
| 54 | activate: () => windowManager.showNamedWindow('settings'), |
| 55 | requiredAPIClass: ChatCompletionAPI, |
| 56 | }, |
| 57 | { |
| 58 | name: 'systemPrompt', |
| 59 | type: 'paragraph', |
| 60 | displayName: 'System Prompt', |
| 61 | requiredAPIClass: ChatCompletionAPI, |
| 62 | }, |
| 63 | { |
| 64 | name: 'contextLength', |
| 65 | type: 'number', |
| 66 | displayName: 'Context Length', |
| 67 | description: 'Maximum number of messages to send per request, default is no limit.', |
| 68 | requiredAPIClass: ChatCompletionAPI, |
| 69 | }, |
| 70 | ]; |
| 71 | serviceManager.registerService({ |
| 72 | serviceClass: MultiChatsService, |
| 73 | apiClasses: [ChatConversationAPI, ChatCompletionAPI], |
| 74 | viewClasses: [MultiChatsView], |
| 75 | description: 'Chat interface supporting multiple conversations.', |
| 76 | priority: 10, |
| 77 | params: chatServiceParams, |
| 78 | }); |
| 79 | serviceManager.registerService({ |
| 80 | serviceClass: ChatService, |
| 81 | apiClasses: [ChatConversationAPI, ChatCompletionAPI], |
| 82 | viewClasses: [ChatView], |
| 83 | description: 'Simple chat interface.', |
| 84 | priority: 9, |
| 85 | params: chatServiceParams, |
| 86 | }); |
| 87 | |
| 88 | // Read config and initialize. |
| 89 | config.addItem('extensions', extensionManager); |
| 90 | config.addItem('apis', apiManager); |
| 91 | config.addItem('assistants', assistantManager); |
| 92 | config.addItem('autoUpdater', autoUpdater); |
| 93 | config.addItem('app', app); // app always initializes at last |
| 94 | config.initFromFileSync(); |
| 95 | |
| 96 | // Register named windows. |
| 97 | windowManager.registerNamedWindow('about', AboutWindow); |
| 98 | windowManager.registerNamedWindow('dashboard', DashboardWindow); |
no test coverage detected