feat(chat): add guest chat mode for unauthenticated users #667

Merged
jason.woltje merged 4 commits from feature/chat-guest-mode into main 2026-03-03 17:52:09 +00:00
2 changed files with 3 additions and 15 deletions
Showing only changes of commit 48d734516a - Show all commits

View File

@@ -1,13 +1,4 @@
import {
Body,
Controller,
HttpException,
Logger,
Post,
Req,
Res,
UseGuards,
} from "@nestjs/common";
import { Body, Controller, HttpException, Logger, Post, Req, Res, UseGuards } from "@nestjs/common";
import type { Response } from "express";
import { AuthGuard } from "../auth/guards/auth.guard";
import type { MaybeAuthenticatedRequest } from "../auth/types/better-auth-request.interface";

View File

@@ -90,10 +90,7 @@ export class ChatProxyService {
* - GUEST_LLM_API_KEY: API key (optional, for cloud providers)
* - GUEST_LLM_MODEL: Model name to use
*/
async proxyGuestChat(
messages: ChatMessage[],
signal?: AbortSignal
): Promise<Response> {
async proxyGuestChat(messages: ChatMessage[], signal?: AbortSignal): Promise<Response> {
const llmUrl = this.config.get<string>("GUEST_LLM_URL") ?? DEFAULT_GUEST_LLM_URL;
const llmApiKey = this.config.get<string>("GUEST_LLM_API_KEY");
const llmModel = this.config.get<string>("GUEST_LLM_MODEL") ?? DEFAULT_GUEST_LLM_MODEL;
@@ -103,7 +100,7 @@ export class ChatProxyService {
};
if (llmApiKey) {
headers["Authorization"] = `Bearer ${llmApiKey}`;
headers.Authorization = `Bearer ${llmApiKey}`;
}
const requestInit: RequestInit = {