Skip to content
Open
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
4 changes: 2 additions & 2 deletions app/(chat)/page.tsx → app/(chat)/chat/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Chat } from '@/components/chat';
import { DEFAULT_CHAT_MODEL } from '@/lib/ai/models';
import { generateUUID } from '@/lib/utils';
import { DataStreamHandler } from '@/components/data-stream-handler';
import { auth } from '../(auth)/auth';
import { auth } from '../../(auth)/auth';
import { redirect } from 'next/navigation';

export default async function Page() {
Expand All @@ -31,7 +31,7 @@ export default async function Page() {
initialVisibilityType="private"
isReadonly={false}
session={session}
autoResume={false}
autoResume={false}
initialApiKey={apiKeyFromCookie?.value ?? ''}
/>
<DataStreamHandler id={id} />
Expand Down
16 changes: 15 additions & 1 deletion app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
--foreground-rgb: 0, 0, 0;
--background-start-rgb: 214, 219, 220;
--background-end-rgb: 255, 255, 255;
--black: #040404;
--tower-gray: #aec0bd;
--mountain-meadow: #169994;
--deep-sea-green: #076057;
--tiber: #042d2d;
--corduroy: #5b6464;
--mine-shaft: #2c2c2c;
--blue-chill: #087a85;
--blue-whale: #043b44;
--black-pearl: #071b24;
}

/* Light-only: remove dark scheme overrides */
Expand Down Expand Up @@ -120,5 +130,9 @@
}

.suggestion-highlight {
@apply bg-blue-200 hover:bg-blue-300;
background-color: rgba(7, 96, 87, 0.2);
}

.suggestion-highlight:hover {
background-color: rgba(7, 96, 87, 0.3);
}
21 changes: 21 additions & 0 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Link from 'next/link';
import Spline from '@splinetool/react-spline/next';

export default function Home() {
return (
<main className="w-full h-screen relative bg-white">
<Spline
className="size-full"
scene="https://prod.spline.design/DS0UgrDOifhNt9T6/scene.splinecode"
/>
<div className="absolute inset-0 flex items-center justify-center">
<Link
href="/chat"
className="px-6 py-3 rounded-lg text-white bg-[var(--deep-sea-green)] hover:bg-[var(--tiber)] transition-colors"
>
Try Demo
</Link>
</div>
</main>
);
Comment on lines +1 to +20

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Keep chat helpers in sync with new /chat route

The new landing page at app/page.tsx removes the chat UI from / but there is no redirect or compatibility shim for callers that still assume the home route opens a chat session. Existing Playwright helpers (tests/pages/chat.ts#createNewChat) and login tests navigate to '/' and assert the chat textbox is present, so they will now land on this Spline scene and fail. Either redirect unauthenticated users from / to /chat or update the tests/helpers to use /chat directly so automated flows keep passing.

Useful? React with 👍 / 👎.

}
4 changes: 2 additions & 2 deletions components/message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const PurePreviewMessage = ({
>
<div
className={cn(
'flex gap-4 w-full group-data-[role=user]/message:ml-auto group-data-[role=user]/message:max-w-2xl',
'flex gap-4 w-full group-data-[role=user]/message:ml-auto group-data-[role=user]/message:max-w-2xl group-data-[role=user]/message:bg-[var(--deep-sea-green)] group-data-[role=user]/message:text-white group-data-[role=user]/message:rounded-xl group-data-[role=user]/message:p-3',
{
'w-full': mode === 'edit',
'group-data-[role=user]/message:w-fit': mode !== 'edit',
Expand Down Expand Up @@ -266,7 +266,7 @@ export const ThinkingMessage = () => {
className={cx(
'flex gap-4 group-data-[role=user]/message:px-3 w-full group-data-[role=user]/message:w-fit group-data-[role=user]/message:ml-auto group-data-[role=user]/message:max-w-2xl group-data-[role=user]/message:py-2 rounded-xl',
{
'group-data-[role=user]/message:bg-muted': true,
'group-data-[role=user]/message:bg-[var(--deep-sea-green)] group-data-[role=user]/message:text-white': true,
},
)}
>
Expand Down
19 changes: 15 additions & 4 deletions components/webset-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,21 @@ export function WebsetTable({ csv }: WebsetTableProps) {
style={{ width: columnWidths[header] ?? 150 }}
className="px-4 py-2 font-bold border-r border-b border-border bg-muted sticky top-0 z-10"
>
<div className="flex items-center justify-between gap-2 cursor-pointer select-none" onClick={() => {
if (sortedColumn === header) setSortDirection((d) => (d === 'asc' ? 'desc' : 'asc'));
else setSortedColumn(header);
}}>
<div
role="button"
tabIndex={0}
className="flex items-center justify-between gap-2 cursor-pointer select-none"
onClick={() => {
if (sortedColumn === header) setSortDirection((d) => (d === 'asc' ? 'desc' : 'asc'));
else setSortedColumn(header);
}}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
if (sortedColumn === header) setSortDirection((d) => (d === 'asc' ? 'desc' : 'asc'));
else setSortedColumn(header);
}
}}
>
<span className="text-xs font-bold">
{visibleColumns[header] === false ? (
<span className="line-through opacity-50">{header}</span>
Expand Down
19 changes: 12 additions & 7 deletions lib/googleTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,29 @@ export async function getFreshAccessToken(): Promise<FreshTokens> {
const tokenSet = getTokenSet(sessionId);

let accessToken = jar.get('gc_access_token')?.value || tokenSet?.access_token;
let refreshToken = jar.get('gc_refresh_token')?.value || tokenSet?.refresh_token;
let refreshToken =
jar.get('gc_refresh_token')?.value || tokenSet?.refresh_token;
const expiresAtStr =
jar.get('gc_expires_at')?.value ||
(tokenSet?.expires_at != null ? String(tokenSet.expires_at) : undefined);
let expiresAt = expiresAtStr ? Number(expiresAtStr) : undefined;

const now = Date.now();
const isExpiringSoon = expiresAt != null && now > expiresAt - EXPIRY_SKEW_MS;
const shouldRefresh = Boolean(refreshToken && (!accessToken || isExpiringSoon));
const shouldRefresh = Boolean(
refreshToken && (!accessToken || isExpiringSoon),
);

if (shouldRefresh) {
if (shouldRefresh && refreshToken) {
try {
const config = await getGoogleClient();
const refreshed = await refreshTokenGrant(config, refreshToken!);
const refreshed = await refreshTokenGrant(config, refreshToken);
accessToken = refreshed.access_token || accessToken;
refreshToken = refreshed.refresh_token || refreshToken;
expiresAt =
refreshed.expires_in != null ? now + refreshed.expires_in * 1000 : expiresAt;
refreshed.expires_in != null
? now + refreshed.expires_in * 1000
: expiresAt;

// Persist refreshed tokens
const cookieOptions = {
Expand All @@ -46,7 +51,8 @@ export async function getFreshAccessToken(): Promise<FreshTokens> {
maxAge: 60 * 60 * 24 * 7,
};
if (accessToken) jar.set('gc_access_token', accessToken, cookieOptions);
if (refreshToken) jar.set('gc_refresh_token', refreshToken, cookieOptions);
if (refreshToken)
jar.set('gc_refresh_token', refreshToken, cookieOptions);
if (expiresAt) jar.set('gc_expires_at', String(expiresAt), cookieOptions);
if (sessionId) {
const existing = tokenSet || {};
Expand All @@ -64,4 +70,3 @@ export async function getFreshAccessToken(): Promise<FreshTokens> {

return { accessToken, refreshToken, expiresAt };
}

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"test": "export PLAYWRIGHT=True && pnpm exec playwright test"
},
"dependencies": {
"@ai-sdk/react": "^1.2.11",
"@ai-sdk/openai": "^1.2.15",
"@ai-sdk/react": "^1.2.11",
"@codemirror/lang-javascript": "^6.2.2",
"@codemirror/lang-python": "^6.1.6",
"@codemirror/state": "^6.5.0",
Expand All @@ -33,11 +33,13 @@
"@radix-ui/react-dropdown-menu": "^2.1.2",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-popover": "^1.1.2",
"@radix-ui/react-select": "^2.1.2",
"@radix-ui/react-separator": "^1.1.0",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-tooltip": "^1.1.3",
"@radix-ui/react-visually-hidden": "^1.1.0",
"@splinetool/react-spline": "^4.1.0",
"@vercel/analytics": "^1.3.1",
"@vercel/blob": "^0.24.1",
"@vercel/functions": "^2.0.0",
Expand All @@ -61,6 +63,7 @@
"next": "15.3.0-canary.31",
"next-auth": "5.0.0-beta.25",
"next-themes": "^0.3.0",
"openid-client": "^6.6.4",
"orderedmap": "^2.1.1",
"papaparse": "^5.5.2",
"postgres": "^3.4.4",
Expand All @@ -86,9 +89,7 @@
"tailwind-merge": "^2.5.2",
"tailwindcss-animate": "^1.0.7",
"usehooks-ts": "^3.1.0",
"zod": "^3.23.8",
"@radix-ui/react-popover": "^1.1.2",
"openid-client": "^6.6.4"
"zod": "^3.23.8"
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
Expand Down
60 changes: 60 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.