Skip to content

Commit

Permalink
feat: create assistant with gradio web component
Browse files Browse the repository at this point in the history
  • Loading branch information
sanchezcarlosjr committed Nov 21, 2023
1 parent 9698b19 commit 41cda2d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/app/notebook/assistant/assistant.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
.chatbot {
border: 0;
position: fixed;
bottom: 4em;
bottom: 7em;
right: 2em;
width: 30em;
height: 42em;
width: 32em;
height: 43em;
z-index: 2;
}
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://evatutor.sanchezcarlosjr.com/"></iframe>
<gradio-app *ngIf="showChatbot" info="false" class="chatbot" src="https://evatutor.sanchezcarlosjr.com/"></gradio-app>
2 changes: 1 addition & 1 deletion src/app/notebook/assistant/assistant.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component } from '@angular/core';
import {Component} from '@angular/core';

@Component({
selector: 'app-assistant',
Expand Down
5 changes: 3 additions & 2 deletions src/app/notebook/notebook.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {NgModule} from '@angular/core';
import {CUSTOM_ELEMENTS_SCHEMA, NgModule} from '@angular/core';
import {CommonModule, NgOptimizedImage} from '@angular/common';

import {NotebookRoutingModule} from './notebook-routing.module';
Expand Down Expand Up @@ -61,7 +61,8 @@ import { AssistantComponent } from './assistant/assistant.component';
MatRippleModule,
MatRadioModule,
NgOptimizedImage
]
],
schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
})
export class NotebookModule {
}
2 changes: 2 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@
<app-root></app-root>
<noscript>Please enable JavaScript to continue using this application.</noscript>
<script defer src="https://cdn.jsdelivr.net/pyodide/v0.23.1/full/pyodide.js"></script>
<script defer type="module" src="https://gradio.s3-us-west-2.amazonaws.com/4.4.1/gradio.js"
></script>
</body>
</html>
3 changes: 2 additions & 1 deletion src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ main {
display: block;
}


/**
* Correct the font size and margin on `h1` elements within `section` and
* `article` contexts in Chrome, Firefox, and Safari.
Expand Down Expand Up @@ -842,4 +843,4 @@ py-config {
/* Mermaid */
[aria-roledescription="error"] {
display: none;
}
}

0 comments on commit 41cda2d

Please sign in to comment.