diff --git a/pdf/src/app/pages/pdf-chat/[pdfId].page.ts b/pdf/src/app/pages/pdf-chat/[pdfId].page.ts index 278d564..96f3868 100644 --- a/pdf/src/app/pages/pdf-chat/[pdfId].page.ts +++ b/pdf/src/app/pages/pdf-chat/[pdfId].page.ts @@ -4,7 +4,6 @@ import { CommonModule } from '@angular/common' import { HttpClient } from '@angular/common/http' import { Component, - OnDestroy, OnInit, WritableSignal, inject, @@ -27,7 +26,7 @@ import { IconFieldModule } from 'primeng/iconfield' import { InputIconModule } from 'primeng/inputicon' import { InputTextModule } from 'primeng/inputtext' import { ProgressBarModule } from 'primeng/progressbar' -import { Subject, lastValueFrom } from 'rxjs' +import { lastValueFrom } from 'rxjs' export const routeMeta: RouteMeta = { title: 'PDFun - AI Chat', @@ -43,14 +42,15 @@ export const routeMeta: RouteMeta = { } - @if (assistant()) { + @let assistantId = assistant()?.id; + @if (assistantId) {
- + You can start asking any questions that relate to your PDF file. @@ -89,7 +89,7 @@ export const routeMeta: RouteMeta = { BuyMeACoffeeComponent, ], }) -export default class PDFChatDetailComponent implements OnInit, OnDestroy { +export default class PDFChatDetailComponent implements OnInit { private router = inject(Router) private http = inject(HttpClient) @@ -111,10 +111,6 @@ export default class PDFChatDetailComponent implements OnInit, OnDestroy { assistant: WritableSignal = signal(undefined) - private stopTimer$ = new Subject() - // Polling interval - INTERVAL = 3000 - async ngOnInit(): Promise { const docRef = doc(this.firestore, `${this.filePath}/${this.pdfId()}`) @@ -151,8 +147,4 @@ export default class PDFChatDetailComponent implements OnInit, OnDestroy { this.prompt.set('') this.response.set(result.response) } - - ngOnDestroy() { - this.stopTimer$.next(true) - } } diff --git a/pdf/src/app/pages/pdf-password-removal.page.ts b/pdf/src/app/pages/pdf-password-removal.page.ts index b9a9768..e9f6d86 100644 --- a/pdf/src/app/pages/pdf-password-removal.page.ts +++ b/pdf/src/app/pages/pdf-password-removal.page.ts @@ -12,6 +12,7 @@ import { ButtonModule } from 'primeng/button' import { FileUploadHandlerEvent, FileUploadModule } from 'primeng/fileupload' import { FloatLabelModule } from 'primeng/floatlabel' import { PasswordModule } from 'primeng/password' +import { ProgressBarModule } from 'primeng/progressbar' import { ToastModule } from 'primeng/toast' import { DisclaimerComponent } from '../shared/components/disclaimer/disclaimer.component' import { PdfHandlerBase } from '../shared/components/pdf-handler-base/pdf-handler-base.directive' @@ -36,6 +37,7 @@ export const routeMeta: RouteMeta = { PasswordModule, FormsModule, FloatLabelModule, + ProgressBarModule, ], template: ` @@ -73,31 +75,28 @@ export const routeMeta: RouteMeta = { class="mb-4" /> - @if(loading()) { -
-
- + @if (loading()) { + + } + + @if (errorMessage()) { +

{{ errorMessage() }}

+ } + + @let downloadUrl = downloadUrl$ | async; + @if (downloadUrl) { + - Your file is uploaded and processing. Please wait for a moment. -
- } @if(errorMessage()) { -

{{ errorMessage() }}

- } @if(downloadUrl$ | async; as downloadUrl) { - - } @@ -129,7 +128,7 @@ export default class PdfPasswordRemovalComponent extends PdfHandlerBase { const storageRef = ref( this.storage, - `${this.generateFilePath()}/${fileName}` + `${this.generateFilePath()}/${fileName}`, ) const result = await uploadBytesResumable(storageRef, file) const { uid = 'anonymous' } = diff --git a/pdf/src/app/pages/pdf-to-images.page.ts b/pdf/src/app/pages/pdf-to-images.page.ts index d3a4746..3d2a2a2 100644 --- a/pdf/src/app/pages/pdf-to-images.page.ts +++ b/pdf/src/app/pages/pdf-to-images.page.ts @@ -9,6 +9,7 @@ import { BuyMeACoffeeComponent } from '@pdfun/ui/common' import { nanoid } from 'nanoid' import { ButtonModule } from 'primeng/button' import { FileUploadHandlerEvent, FileUploadModule } from 'primeng/fileupload' +import { ProgressBarModule } from 'primeng/progressbar' import { ToastModule } from 'primeng/toast' import { DisclaimerComponent } from '../shared/components/disclaimer/disclaimer.component' import { PdfHandlerBase } from '../shared/components/pdf-handler-base/pdf-handler-base.directive' @@ -30,6 +31,7 @@ export const routeMeta: RouteMeta = { FileUploadModule, BuyMeACoffeeComponent, DisclaimerComponent, + ProgressBarModule, ], template: ` @@ -54,29 +56,28 @@ export const routeMeta: RouteMeta = { class="mb-4" /> - @if(loading()) { -
-
- + @if (loading()) { + + } + + @if (errorMessage()) { +

{{ errorMessage() }}

+ } + + @let downloadUrl = downloadUrl$ | async; + @if (downloadUrl) { + - Your file is uploaded and processing. Please wait for a moment. -
- } @if(errorMessage()) { -

{{ errorMessage() }}

- } @if(downloadUrl$ | async; as downloadUrl) { - - - - Download Images - - - } @@ -99,7 +100,7 @@ export default class PdfToImagesComponent extends PdfHandlerBase { const storageRef = ref( this.storage, - `${this.generateFilePath()}/${fileName}` + `${this.generateFilePath()}/${fileName}`, ) const result = await uploadBytesResumable(storageRef, file) const { uid = 'anonymous' } =