-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
287 additions
and
44 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...ent/src/app/components/recognition-engine-select/recognition-engine-select.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
packages/client/src/app/modules/user/components/provider/provider.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<div class="card bg-base-100 shadow-xl flex flex-col"> | ||
<div class="card-body"> | ||
<div class="card-title"><span translate>USER.PROVIDER.title</span></div> | ||
<div class="text-sm mb-3" translate>USER.PROVIDER.description</div> | ||
|
||
<app-recognition-engine-select></app-recognition-engine-select> | ||
<ng-container *ngIf="provider() as p"> | ||
<div class="text-md mt-3">{{'USER.PROVIDER.' + p + '.label' | translate}}</div> | ||
<p>{{'USER.PROVIDER.' + p + '.description' | translate }}</p> | ||
|
||
</ng-container> | ||
</div> | ||
</div> |
Empty file.
21 changes: 21 additions & 0 deletions
21
packages/client/src/app/modules/user/components/provider/provider.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { ProviderComponent } from './provider.component'; | ||
|
||
describe('ProviderComponent', () => { | ||
let component: ProviderComponent; | ||
let fixture: ComponentFixture<ProviderComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ProviderComponent], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(ProviderComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
22 changes: 22 additions & 0 deletions
22
packages/client/src/app/modules/user/components/provider/provider.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Component, Signal } from '@angular/core'; | ||
import { toSignal } from '@angular/core/rxjs-interop'; | ||
import { Store, select } from '@ngrx/store'; | ||
import { AppState } from '../../../../models/app.model'; | ||
import { RecognitionEngineState } from '../../../../models/recognition.model'; | ||
import { selectRecognitionEngine } from '../../../../selectors/recognition.selector'; | ||
import { map } from 'rxjs'; | ||
|
||
@Component({ | ||
selector: 'app-provider', | ||
templateUrl: './provider.component.html', | ||
styleUrls: ['./provider.component.scss'], | ||
}) | ||
export class ProviderComponent { | ||
public provider: Signal<RecognitionEngineState['provider'] | undefined>; | ||
constructor(private store: Store<AppState>) { | ||
this.provider = toSignal(this.store.pipe( | ||
select(selectRecognitionEngine), | ||
map((e) => e?.provider ) | ||
)); | ||
} | ||
} |
20 changes: 19 additions & 1 deletion
20
packages/client/src/app/modules/user/components/user-home/user-home.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 19 additions & 4 deletions
23
packages/server/src/app/modules/azure-stt/azure-stt.controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,30 @@ | ||
import { Controller, Get, Req } from "@nestjs/common"; | ||
import { Controller, Get, HttpException, HttpStatus, Req, UseGuards } from "@nestjs/common"; | ||
import { AzureSttService } from "./services/azure-stt.service"; | ||
import { NoCache } from "../../decorators/no-cache.decorator"; | ||
import { JwtAuthGuard } from "../../guards/jwt-auth.guard"; | ||
import { UserService } from "../user/services/user.service"; | ||
import { SupporterService } from "../../services/supporter/supporter.service"; | ||
|
||
@Controller('azure-stt') | ||
export class AzureSttController { | ||
constructor(private azureSttService: AzureSttService) {} | ||
constructor( | ||
private azureSttService: AzureSttService, | ||
private userService: UserService, | ||
private supporterService: SupporterService, | ||
) {} | ||
|
||
@Get('get-token') | ||
@NoCache() | ||
// @UseGuards(JwtAuthGuard) | ||
async getSpeechToken(@Req() req): Promise<any> { | ||
@UseGuards(JwtAuthGuard) | ||
async getSpeechToken(@Req() req): Promise<{token: string; region: string}> { | ||
const user = await this.userService.findOne({ id: req.user.id }); | ||
if (!user) { | ||
throw new HttpException(`User not found`, HttpStatus.NOT_FOUND) | ||
} | ||
const supporter = await this.supporterService.findOne({ email: user.primaryEmail }); | ||
if (!supporter || !supporter.amountCents) { | ||
throw new HttpException(`User is not a supporter`, HttpStatus.BAD_REQUEST); | ||
} | ||
return this.azureSttService.getToken(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 3 additions & 9 deletions
12
packages/server/src/app/modules/azure-stt/services/azure-stt.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.