AOSSIE-Org / AOSSIE-Org/Ell-ena

summarize-transcription Edge Function has no input size limit - oversized transcriptions exhaust function memory and Supabase billing

Đang mở
#309 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Dart
Star
54
Fork
110
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

## Problem

The `supabase/functions/summarize-transcription/` Edge Function accepts
meeting transcription text and passes it to the Gemini API for summarization.
There is no maximum input size check before the function processes the text.

Supabase Edge Functions run on Deno with a memory limit (typically 150MB).
A very long meeting transcription (e.g. a 4-hour all-hands meeting producing
100,000+ tokens) can:

1. Exceed the Gemini API's context window, causing the API call to fail with
an unclear error.
2. Exhaust the Edge Function's memory limit, causing the function to crash
with a 500 error and no useful error message returned to the client.
3. Generate outsized Gemini API charges if the input is not truncated before
billing begins.

## Suggested Fix

1. Add a hard character limit (e.g. 500,000 characters) to the transcription
input before processing:
```typescript
const MAX_INPUT_CHARS = 500_000;
if (transcription.length > MAX_INPUT_CHARS) {
return new Response(JSON.stringify({ error: "Transcription too long" }), { status: 413 });
}
```
2. For long transcriptions, implement chunked summarization: split the text
into overlapping chunks, summarize each, then summarize the summaries.
3. Return HTTP 413 (Payload Too Large) with a clear message when the limit
is exceeded.
4. Document the maximum supported transcription length in `BACKEND.md`.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Start in supabase/functions/summarize-transcription/ and trace how transcription input is received and passed to Gemini. Compare the hard-limit and chunked-summarization options, then check BACKEND.md for the documentation requirement. Done means oversized input has a clear 413 response, long-input behavior is defined, and the supported maximum is documented.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
deno, supabase, typescript
Lĩnh vực
api, backend, cloud
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
52/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.