-
Notifications
You must be signed in to change notification settings - Fork 1
/
Main.svelte
39 lines (36 loc) · 1.27 KB
/
Main.svelte
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
<script lang="ts">
import { connectionReady, notebookCommModel, kernelStatus, restrictNotebooks, wizardMode } from '../stores';
import Chat from './chat/Chat.svelte';
import AutoCompleteInput from './chat/AutoCompleteInput.svelte';
import Header from './header/Header.svelte';
import WizardChat from './chat/WizardChat.svelte';
import { get } from 'svelte/store';
import type { IChatInstance } from '../chatinstance';
let chatInstance: IChatInstance;
let name: string;
$: if ($notebookCommModel) {
chatInstance = get($notebookCommModel.chatInstances)["base"]
}
$: if ($connectionReady && $notebookCommModel) {
name = $notebookCommModel.name;
}
$: ({ hasKernel } = $kernelStatus);
</script>
{#if chatInstance}
{#if $notebookCommModel && ($restrictNotebooks.length === 0 || $restrictNotebooks.includes(name)) }
<Header {chatInstance} title="Newton - {name}"/>
<Chat {chatInstance}/>
{#if $hasKernel}
{#if $wizardMode}
<WizardChat {chatInstance}/>
{:else}
<AutoCompleteInput {chatInstance}/>
{/if}
{/if}
{:else}
<Header {chatInstance} title="Newton"/>
{#if $restrictNotebooks.length !== 0}
Currently, the chatbot only works on files named {$restrictNotebooks.join(" or ")}.
{/if}
{/if}
{/if}