Get transcript summaries of Web videos.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.3 KiB

  1. import { FastifyInstance } from 'fastify';
  2. import { SummaryController, SummaryControllerImpl } from './modules/summary';
  3. import { TranscriptController, TranscriptControllerImpl } from './modules/transcript/TranscriptController';
  4. export const addHealthRoutes = (server: FastifyInstance) => {
  5. server
  6. .route({
  7. method: 'GET',
  8. url: '/api/health/live',
  9. handler: async (_, reply) => {
  10. reply.send({ status: 'ok' });
  11. },
  12. })
  13. .route({
  14. method: 'GET',
  15. url: '/api/health/ready',
  16. handler: async (_, reply) => {
  17. reply.send({ status: 'ok' });
  18. },
  19. });
  20. };
  21. export const addSummaryRoutes = (server: FastifyInstance) => {
  22. const summaryController: SummaryController = new SummaryControllerImpl();
  23. server
  24. .route({
  25. method: 'POST',
  26. url: '/api/summarize',
  27. handler: summaryController.summarizeVideoTranscript,
  28. });
  29. };
  30. export const addTranscriptRoutes = (server: FastifyInstance) => {
  31. const transcriptController: TranscriptController = new TranscriptControllerImpl();
  32. server
  33. .route({
  34. method: 'GET',
  35. url: '/api/transcripts/get/:videoType/:videoId',
  36. handler: transcriptController.getVideoTranscript,
  37. })
  38. .route({
  39. method: 'POST',
  40. url: '/api/transcripts/normalize',
  41. handler: transcriptController.normalizeVideoTranscriptText,
  42. });
  43. };