Repository navigation
Harden Recoup MCP tools for OpenAI review #1297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
bf13010
Harden Recoup MCP social refresh and catalog search
sidneyswift 66a7f70
Merge remote-tracking branch 'origin/main' into codex/recoup-mcp-review
sidneyswift 7b88f61
Serialize MCP refresh quotes and bound catalog continuation
sidneyswift 31ad0ee
Order Redis test double members for lint
sidneyswift File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -3,36 +3,40 @@ import { type CatalogSongWithArtists } from "@/lib/supabase/catalog_songs/select | |
| import { refineResults } from "./refineResults"; | ||
|
|
||
| const BATCH_SIZE = 100; | ||
| const MAX_PAGES_PER_SEARCH = 10; | ||
|
|
||
| export interface AnalyzeFullCatalogOptions { | ||
| catalogId: string; | ||
| criteria: string; | ||
| startPage?: number; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3: The new pagination options leave Prompt for AI agents |
||
| } | ||
|
|
||
| /** | ||
| * Fetches all songs from a catalog and filters them using AI in parallel batches | ||
| * Following Open-Closed Principle: open for extension (custom filtering logic), closed for modification | ||
| * | ||
| * @param catalog - The catalog to analyze | ||
| * @param catalog.catalogId - The ID of the catalog to analyze | ||
| * @param catalog.criteria - The criteria to use to filter the songs | ||
| * @returns The results of the analysis | ||
| * Analyze up to ten 100-track pages, starting at the one-based startPage. | ||
| * A nextPage value resumes the search when additional catalog rows remain. | ||
| */ | ||
| export async function analyzeFullCatalog({ | ||
| catalogId, | ||
| criteria, | ||
| startPage = 1, | ||
| }: AnalyzeFullCatalogOptions): Promise<{ | ||
| results: CatalogSongWithArtists[]; | ||
| totalSongs: number; | ||
| totalPages: number; | ||
| nextPage?: number; | ||
| }> { | ||
| // Fetch first page to get total count | ||
| const firstPage = await selectCatalogSongsWithArtists({ catalogId, limit: BATCH_SIZE, page: 1 }); | ||
| const firstPage = await selectCatalogSongsWithArtists({ | ||
| catalogId, | ||
| limit: BATCH_SIZE, | ||
| page: 1, | ||
| }); | ||
| const totalPages = Math.ceil(firstPage.total_count / BATCH_SIZE); | ||
| const totalSongs = firstPage.total_count; | ||
|
|
||
| // Fetch all pages in parallel | ||
| const pageNumbers = Array.from({ length: totalPages }, (_, i) => i + 1); | ||
| // Fetch one bounded window of pages in parallel | ||
| const pageCount = Math.max(0, Math.min(MAX_PAGES_PER_SEARCH, totalPages - startPage + 1)); | ||
| const pageNumbers = Array.from({ length: pageCount }, (_, i) => i + startPage); | ||
| const pagePromises = pageNumbers.map(async pageNum => | ||
| pageNum === 1 | ||
| ? firstPage.songs | ||
|
|
@@ -50,5 +54,6 @@ export async function analyzeFullCatalog({ | |
| results, | ||
| totalSongs, | ||
| totalPages, | ||
| ...(startPage + pageCount <= totalPages ? { nextPage: startPage + pageCount } : {}), | ||
| }; | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.