Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions app/api/accounts/[id]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ export async function OPTIONS() {
* - id (required): The unique identifier of the account (UUID)
*
* @param request - The request object
* @param params.params
* @param params - Route params containing the account ID
* @returns A NextResponse with account data
*/
export async function GET(
request: NextRequest,
{ params }: { params: Promise<{ id: string }> },
) {
export async function GET(request: NextRequest, { params }: { params: Promise<{ id: string }> }) {
return getAccountHandler(request, params);
}

13 changes: 3 additions & 10 deletions app/api/admins/sandboxes/__tests__/route.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { NextRequest, NextResponse } from "next/server";

const mockGetAdminSandboxesHandler = vi.fn();
vi.mock("@/lib/admins/sandboxes/getAdminSandboxesHandler", () => ({
getAdminSandboxesHandler: (...args: unknown[]) =>
mockGetAdminSandboxesHandler(...args),
getAdminSandboxesHandler: (...args: unknown[]) => mockGetAdminSandboxesHandler(...args),
}));

const { GET, OPTIONS } = await import("../route");
Expand All @@ -15,10 +14,7 @@ beforeEach(() => {

describe("GET /api/admins/sandboxes", () => {
it("delegates to getAdminSandboxesHandler and returns its response", async () => {
const expected = NextResponse.json(
{ status: "success", accounts: [] },
{ status: 200 },
);
const expected = NextResponse.json({ status: "success", accounts: [] }, { status: 200 });
mockGetAdminSandboxesHandler.mockResolvedValue(expected);

const request = new NextRequest("https://example.com/api/admins/sandboxes");
Expand Down Expand Up @@ -86,10 +82,7 @@ describe("GET /api/admins/sandboxes", () => {

it("returns 500 when handler returns internal error", async () => {
mockGetAdminSandboxesHandler.mockResolvedValue(
NextResponse.json(
{ status: "error", message: "Internal server error" },
{ status: 500 },
),
NextResponse.json({ status: "error", message: "Internal server error" }, { status: 500 }),
);

const request = new NextRequest("https://example.com/api/admins/sandboxes");
Expand Down
1 change: 0 additions & 1 deletion app/api/artists/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,3 @@ export async function GET(request: NextRequest) {
export async function POST(request: NextRequest) {
return createArtistPostHandler(request);
}

33 changes: 7 additions & 26 deletions app/api/coding-agent/[platform]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,14 @@ import { after } from "next/server";
import { codingAgentBot } from "@/lib/coding-agent/bot";
import "@/lib/coding-agent/handlers/registerHandlers";

/**
* GET /api/coding-agent/[platform]
*
* Handles webhook verification handshakes (e.g. WhatsApp hub.challenge).
*
* @param request - The incoming verification request
* @param params - Route params containing the platform name
*/
export async function GET(
request: NextRequest,
{ params }: { params: Promise<{ platform: string }> },
) {
const { platform } = await params;

const handler = codingAgentBot.webhooks[platform as keyof typeof codingAgentBot.webhooks];

if (!handler) {
return new Response("Unknown platform", { status: 404 });
}

return handler(request, { waitUntil: p => after(() => p) });
}

/**
* POST /api/coding-agent/[platform]
*
* Webhook endpoint for the coding agent bot.
* Handles Slack and WhatsApp webhooks via dynamic [platform] segment.
* Currently handles Slack webhooks via dynamic [platform] segment.
*
* @param request - The incoming webhook request
* @param params.params
* @param params - Route params containing the platform name
*/
export async function POST(
Expand All @@ -44,8 +22,11 @@ export async function POST(
// Handle Slack url_verification challenge before loading the bot.
// This avoids blocking on Redis/adapter initialization during setup.
if (platform === "slack") {
const body = await request.clone().json().catch(() => null);
if (body?.type === "url_verification" && typeof body?.challenge === "string") {
const body = await request
.clone()
.json()
.catch(() => null);
if (body?.type === "url_verification" && body?.challenge) {
return Response.json({ challenge: body.challenge });
}
}
Expand Down
4 changes: 1 addition & 3 deletions app/api/coding-agent/callback/__tests__/route.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import { describe, it, expect, vi, beforeEach } from "vitest";
import { NextRequest } from "next/server";

const mockInitialize = vi.fn();
const mockHandleCallback = vi.fn().mockResolvedValue(
new Response("ok", { status: 200 }),
);
const mockHandleCallback = vi.fn().mockResolvedValue(new Response("ok", { status: 200 }));

vi.mock("@/lib/coding-agent/bot", () => ({
codingAgentBot: {
Expand Down
32 changes: 0 additions & 32 deletions app/api/content/create/route.ts

This file was deleted.

32 changes: 0 additions & 32 deletions app/api/content/estimate/route.ts

This file was deleted.

32 changes: 0 additions & 32 deletions app/api/content/templates/route.ts

This file was deleted.

32 changes: 0 additions & 32 deletions app/api/content/validate/route.ts

This file was deleted.

1 change: 0 additions & 1 deletion app/api/organizations/artists/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ export async function OPTIONS() {
export async function POST(request: NextRequest) {
return addArtistToOrgHandler(request);
}

1 change: 1 addition & 0 deletions app/api/songs/analyze/presets/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export async function OPTIONS() {
* - status: "success"
* - presets: Array of { name, label, description, requiresAudio, responseFormat }
*
* @param request
* @returns A NextResponse with the list of available presets
*/
export async function GET(request: NextRequest): Promise<NextResponse> {
Expand Down
1 change: 0 additions & 1 deletion app/api/spotify/artist/albums/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ export async function OPTIONS() {
export async function GET(request: NextRequest) {
return getSpotifyArtistAlbumsHandler(request);
}

5 changes: 4 additions & 1 deletion app/api/transcribe/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import { NextRequest, NextResponse } from "next/server";
import { processAudioTranscription } from "@/lib/transcribe/processAudioTranscription";
import { formatTranscriptionError } from "@/lib/transcribe/types";

/**
*
* @param req
*/
export async function POST(req: NextRequest) {
try {
const body = await req.json();
Expand Down Expand Up @@ -40,4 +44,3 @@ export async function POST(req: NextRequest) {
return NextResponse.json({ error: message }, { status });
}
}

5 changes: 1 addition & 4 deletions evals/catalog-songs-count.eval.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { Eval } from "braintrust";
import { Factuality, AnswerCorrectness } from "autoevals";
import {
callChatFunctionsWithResult,
extractTextFromResult,
} from "@/lib/evals";
import { callChatFunctionsWithResult, extractTextFromResult } from "@/lib/evals";
import getCatalogSongsCountData from "@/lib/evals/getCatalogSongsCountData";

/**
Expand Down
12 changes: 4 additions & 8 deletions evals/first-week-album-sales.eval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import { callChatFunctions } from "@/lib/evals";
Eval("First Week Album Sales Evaluation", {
data: () => [
{
input:
"how many albums did Halsey The Great Impersonator sell the first week of release",
input: "how many albums did Halsey The Great Impersonator sell the first week of release",
expected:
"Halsey's album 'The Great Impersonator' sold between 93,000 and 100,000 copies in its first week of release. It debuted at No. 2 on the Billboard 200 chart.",
metadata: {
Expand All @@ -26,8 +25,7 @@ Eval("First Week Album Sales Evaluation", {
},
},
{
input:
"what were the first week sales for Taylor Swift's Midnights album?",
input: "what were the first week sales for Taylor Swift's Midnights album?",
expected:
"Taylor Swift's Midnights sold 1.578 million equivalent album units in its first week in the United States, which included between 1 million and 1.5 million pure album sales. This marked the biggest sales week for any album since Adele's 25 in 2015 and the best sales week for a vinyl album in the modern tracking era.",
metadata: {
Expand All @@ -38,8 +36,7 @@ Eval("First Week Album Sales Evaluation", {
},
},
{
input:
"how many copies did Drake's Certified Lover Boy sell in the first week",
input: "how many copies did Drake's Certified Lover Boy sell in the first week",
expected:
"Drake's 'Certified Lover Boy' sold approximately 613,000 album-equivalent units in its first week, securing the #1 spot on the Billboard 200 chart.",
metadata: {
Expand All @@ -50,8 +47,7 @@ Eval("First Week Album Sales Evaluation", {
},
},
{
input:
"what are the first week streaming numbers for Bad Bunny's Un Verano Sin Ti",
input: "what are the first week streaming numbers for Bad Bunny's Un Verano Sin Ti",
expected:
"In its first week of release in the United States, Bad Bunny's album Un Verano Sin Ti garnered over 355 million on-demand streams and 274,000 album-equivalent units, the most for any album that year and the largest streaming week for a Latin album ever at that time. The album also set a record for the biggest debut for a Latin album in Spotify's history.",
metadata: {
Expand Down
2 changes: 1 addition & 1 deletion evals/memory-tools.eval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Eval("Memory & Storage Tools Evaluation", {
const result = await callChatFunctionsWithResult(input);
const output = extractTextFromResult(result);
const toolCalls =
result.toolCalls?.map((tc) => ({
result.toolCalls?.map(tc => ({
toolName: tc.toolName,
args: {},
})) || [];
Expand Down
2 changes: 1 addition & 1 deletion evals/monthly-listeners-tracking.eval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Eval("Monthly Listeners Tracking Evaluation", {
data: () => {
const { startDateFormatted, endDateFormatted } = getDynamicDates();

const testCases = EVAL_ARTISTS.map((artist) => ({
const testCases = EVAL_ARTISTS.map(artist => ({
input: `what is the increase for ${artist} monthlies from ${startDateFormatted} to ${endDateFormatted}`,
expected: `I've set up a monthlies tracking for ${artist}. would you like to receive the updated list in your email?`,
metadata: {
Expand Down
9 changes: 3 additions & 6 deletions evals/search-web-tool.eval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ This year's Grammys were notable for historic wins, genre-crossing breakthroughs
},
},
{
input:
"What are the current Spotify streaming numbers for Bad Bunny's latest album?",
input: "What are the current Spotify streaming numbers for Bad Bunny's latest album?",
expected: `Bad Bunny's latest album titled "DeBÍ TiRAR MáS FOToS," released in 2025, currently has around 1.07 billion streams on Spotify. His previous album "Un Verano Sin Ti" has over 20.6 billion streams on Spotify, making it one of the most streamed albums on the platform as of late 2025.`,
metadata: {
category: "streaming_data",
Expand Down Expand Up @@ -181,8 +180,7 @@ These collaborations highlight a range of featured artists who dropped new track
},
},
{
input:
"What are the current music industry revenue statistics for Q2 2025?",
input: "What are the current music industry revenue statistics for Q2 2025?",
expected: `The current music industry revenue statistics for Q2 2025 show continued growth driven primarily by streaming and subscription services.

Key highlights from major companies:
Expand Down Expand Up @@ -227,8 +225,7 @@ Overall, 2025 sees music copyright law adapting to address the growing influence
},
},
{
input:
"What are the latest features on TikTok for music creators in Q2 2025?",
input: "What are the latest features on TikTok for music creators in Q2 2025?",
expected: `The latest features on TikTok for music creators in Q2 2025 center around the beta launch of TikTok Songwriter Features. These include:

- Songwriter Account Label: Music creators can create official Songwriter accounts that add a clear "Songwriter" label to their profile for identification.
Expand Down
Loading
Loading