Skip to content

Commit

Permalink
feat: show chatbot
Browse files Browse the repository at this point in the history
  • Loading branch information
sanchezcarlosjr committed Nov 20, 2023
1 parent 57abfa7 commit 67beba8
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 24 deletions.
23 changes: 23 additions & 0 deletions src/app/notebook/assistant/assistant.component.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.chatbot-toggle {
position: fixed;
bottom: 1em;
right: 1.5em;
width: 4em;
height: 4em;
background-color: #f1f1f1;
border-radius: 20em;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
overflow: hidden;
z-index: 3;
cursor: pointer;
}

.chatbot {
border: 0;
position: fixed;
bottom: 4em;
right: 2em;
width: 30em;
height: 42em;
z-index: 2;
}
2 changes: 2 additions & 0 deletions src/app/notebook/assistant/assistant.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +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>
23 changes: 23 additions & 0 deletions src/app/notebook/assistant/assistant.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { AssistantComponent } from './assistant.component';

describe('AssistantComponent', () => {
let component: AssistantComponent;
let fixture: ComponentFixture<AssistantComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AssistantComponent ]
})
.compileComponents();

fixture = TestBed.createComponent(AssistantComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
13 changes: 13 additions & 0 deletions src/app/notebook/assistant/assistant.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Component } from '@angular/core';

@Component({
selector: 'app-assistant',
templateUrl: './assistant.component.html',
styleUrls: ['./assistant.component.css']
})
export class AssistantComponent {
showChatbot = false;
toggleChatbot() {
this.showChatbot = !this.showChatbot;
}
}
2 changes: 2 additions & 0 deletions src/app/notebook/notebook.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@
</mat-toolbar>

<section id="editor-js"><p *ngIf="loading">Loading...</p></section>

<app-assistant></app-assistant>
51 changes: 27 additions & 24 deletions src/app/notebook/notebook.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {CommonModule, NgOptimizedImage} from '@angular/common';

import {NotebookRoutingModule} from './notebook-routing.module';
import {NotebookComponent} from './notebook.component';
Expand All @@ -26,6 +26,7 @@ import { ShareDialogComponent } from './share-dialog.component';
import {MatDialogModule} from "@angular/material/dialog";
import { ClipboardModule } from '@angular/cdk/clipboard';
import {HistoryComponent} from "./history.component";
import { AssistantComponent } from './assistant/assistant.component';

@NgModule({
declarations: [
Expand All @@ -35,30 +36,32 @@ import {HistoryComponent} from "./history.component";
TreeComponent,
ShareDialogComponent,
HistoryComponent,
CodeComponent
CodeComponent,
AssistantComponent
],
imports: [
CommonModule,
NotebookRoutingModule,
JsonFormsModule,
JsonFormsAngularMaterialModule,
MatAutocompleteModule,
MatButtonModule,
MatToolbarModule,
MatMenuModule,
MatButtonModule,
MatSnackBarModule,
FormsModule,
MatDialogModule,
MatTableModule,
MatSortModule,
MatPaginatorModule,
MatTreeModule,
ClipboardModule,
MatCardModule,
MatRippleModule,
MatRadioModule
]
imports: [
CommonModule,
NotebookRoutingModule,
JsonFormsModule,
JsonFormsAngularMaterialModule,
MatAutocompleteModule,
MatButtonModule,
MatToolbarModule,
MatMenuModule,
MatButtonModule,
MatSnackBarModule,
FormsModule,
MatDialogModule,
MatTableModule,
MatSortModule,
MatPaginatorModule,
MatTreeModule,
ClipboardModule,
MatCardModule,
MatRippleModule,
MatRadioModule,
NgOptimizedImage
]
})
export class NotebookModule {
}
Binary file added src/assets/avatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 67beba8

Please sign in to comment.