Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
b454517
feat: migrate ChatConfig interface from Recoup-Chat to recoup-api
sweetmantech Jan 14, 2026
8385ca5
feat: migrate validateChatRequest function from Recoup-Chat
sweetmantech Jan 14, 2026
ffe29f5
feat: migrate setupChatRequest function from Recoup-Chat
sweetmantech Jan 14, 2026
a2d36cb
feat: create /api/chat streaming endpoint
sweetmantech Jan 14, 2026
6f71c16
feat: create /api/chat/generate non-streaming endpoint
sweetmantech Jan 14, 2026
678445e
feat: add title generation to /api/chats endpoint
sweetmantech Jan 15, 2026
9cc8a03
fix: change validateChatRequest return type to NextResponse
sweetmantech Jan 15, 2026
0ebc38e
fix: properly type providerOptions in ChatConfig
sweetmantech Jan 15, 2026
a2091b5
chore: add AI SDK provider packages
sweetmantech Jan 15, 2026
38b795c
feat: migrate handleChatCredits from Recoup-Chat to recoup-api
sweetmantech Jan 15, 2026
f81e9dc
chore: add @ai-sdk/gateway package
sweetmantech Jan 15, 2026
a23d48b
feat: migrate handleChatCompletion from Recoup-Chat to recoup-api
sweetmantech Jan 15, 2026
dd3a150
test: add unit tests for getGeneralAgent and supporting functions
sweetmantech Jan 15, 2026
d86309c
feat: complete setupToolsForRequest migration with Google Sheets inte…
sweetmantech Jan 15, 2026
78c0da4
fix: use inputSchema instead of parameters in googleSheetsLoginTool
sweetmantech Jan 15, 2026
b7d17cd
feat: migrate toolChains framework from Recoup-Chat to recoup-api
sweetmantech Jan 15, 2026
20a32ff
feat: add Authorization header support to chat endpoints
sweetmantech Jan 15, 2026
08c1d6f
feat: migrate getMcpTools (web_deep_research, artist_deep_research) f…
sweetmantech Jan 15, 2026
94286aa
test: add integration tests for chat migration
sweetmantech Jan 15, 2026
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
48 changes: 48 additions & 0 deletions app/api/chat/generate/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import type { NextRequest } from "next/server";
import { NextResponse } from "next/server";
import { getCorsHeaders } from "@/lib/networking/getCorsHeaders";
import { handleChatGenerate } from "@/lib/chat/handleChatGenerate";

/**
* OPTIONS handler for CORS preflight requests.
*
* @returns A NextResponse with CORS headers.
*/
export async function OPTIONS() {
return new NextResponse(null, {
status: 200,
headers: getCorsHeaders(),
});
}

/**
* POST /api/chat/generate
*
* Non-streaming chat endpoint that processes messages and returns a JSON response.
*
* Authentication: x-api-key header required.
* The account ID is inferred from the API key.
*
* Request body:
* - messages: Array of chat messages (mutually exclusive with prompt)
* - prompt: String prompt (mutually exclusive with messages)
* - roomId: Optional UUID of the chat room
* - artistId: Optional UUID of the artist account
* - model: Optional model ID override
* - excludeTools: Optional array of tool names to exclude
* - accountId: Optional accountId override (requires org API key)
*
* Response body:
* - text: The generated text response
* - reasoningText: Optional reasoning text (for models that support it)
* - sources: Array of sources used in generation
* - finishReason: The reason generation finished
* - usage: Token usage information
* - response: Additional response metadata
*
* @param request - The request object
* @returns A JSON response with the generated text or error
*/
export async function POST(request: NextRequest): Promise<Response> {
return handleChatGenerate(request);
}
40 changes: 40 additions & 0 deletions app/api/chat/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import type { NextRequest } from "next/server";
import { NextResponse } from "next/server";
import { getCorsHeaders } from "@/lib/networking/getCorsHeaders";
import { handleChatStream } from "@/lib/chat/handleChatStream";

/**
* OPTIONS handler for CORS preflight requests.
*
* @returns A NextResponse with CORS headers.
*/
export async function OPTIONS() {
return new NextResponse(null, {
status: 200,
headers: getCorsHeaders(),
});
}

/**
* POST /api/chat
*
* Streaming chat endpoint that processes messages and returns a streaming response.
*
* Authentication: x-api-key header required.
* The account ID is inferred from the API key.
*
* Request body:
* - messages: Array of chat messages (mutually exclusive with prompt)
* - prompt: String prompt (mutually exclusive with messages)
* - roomId: Optional UUID of the chat room
* - artistId: Optional UUID of the artist account
* - model: Optional model ID override
* - excludeTools: Optional array of tool names to exclude
* - accountId: Optional accountId override (requires org API key)
*
* @param request - The request object
* @returns A streaming response or error
*/
export async function POST(request: NextRequest): Promise<Response> {
return handleChatStream(request);
}
Loading