Skip to content

Commit

Permalink
feat: import notebook from json
Browse files Browse the repository at this point in the history
  • Loading branch information
sanchezcarlosjr committed Nov 21, 2023
1 parent e682736 commit 9698b19
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/app/notebook/assistant/assistant.component.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<img (click)="toggleChatbot()" class="chatbot-toggle" ngSrc="../../../assets/avatar.png" alt="avatar.png" height="512" width="512">
<iframe *ngIf="showChatbot" class="chatbot" src="https://e9c998d63c4940750c.gradio.live/"></iframe>
<iframe *ngIf="showChatbot" class="chatbot" src="https://evatutor.sanchezcarlosjr.com/"></iframe>
4 changes: 3 additions & 1 deletion src/app/notebook/shell/shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ export class Shell {
);
});
environment.addEventListener('shell.ImportNotebook', async (event: CustomEvent) => {
await this.databaseManager.importDatabase(JSON.parse(await event.detail.file.text()));
const notebook = JSON.parse(await event.detail.file.text());
await this.databaseManager.bulkInsertBlocks(notebook.blocks);
location.href = `${location.origin}?t=${notebook.blocks[0].topic}`;
});
environment.addEventListener('shell.DownloadFile', (event: CustomEvent) => {
downloadFile(event.detail.payload.blobParts, event.detail.payload.options);
Expand Down

0 comments on commit 9698b19

Please sign in to comment.