-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.js
More file actions
55 lines (42 loc) · 1.61 KB
/
main.js
File metadata and controls
55 lines (42 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import './style.css';
import './src/dropdown-menu.js';
import './src/tools-list.js';
import './src/tool-editor.js';
import './src/tool-item.js';
import './src/parameter-item.js';
import './src/collapsible-element.js';
import './src/message-item.js';
import './src/key-manager.js'
import './src/service-manager.js';
import './src/setting-input.js';
import { State } from './src/state.js';
import { ChatManager } from './src/chat-manager.js';
import FunkifyChatDelegate from './src/funkify-chat-delegate.js';
import { PromptManager } from './src/prompt-manager.js';
import MessagesManager from './src/messages-manager.js';
if (document.readyState === 'complete') {
onReady();
} else {
document.addEventListener("DOMContentLoaded", onReady);
}
async function onReady () {
const state = new State();
state.storage = localStorage;
state.serviceManager = document.querySelector('service-manager');
state.serviceManager.initialize(state);
const chatDelegate = new FunkifyChatDelegate(state);
state.chatManager = new ChatManager(state, chatDelegate);
state.promptManager = new PromptManager(state);
state.messagesManager = new MessagesManager(state);
state.toolEditor = document.querySelector('tool-editor');
state.toolEditor.initialize(state);
state.toolsList = document.querySelector('tools-list');
state.toolsList.populate(state);
state.promptManager.focusPrompt();
state.pyodide = await loadPyodide();
// Load micropip
await state.pyodide.loadPackage("micropip");
const micropip = state.pyodide.pyimport("micropip");
// Load numpy to see whether the download works.
await micropip.install("numpy");
}