Skip to content

Commit 6fb59d2

Browse files
committed
fix: remove monorepo
1 parent d364a6f commit 6fb59d2

File tree

137 files changed

+191
-1226
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+191
-1226
lines changed

.github/workflows/ci.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ jobs:
4545
with:
4646
wranglerVersion: '* -w'
4747
packageManager: pnpm
48-
workingDirectory: 'packages/bolt'
4948
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
5049
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
5150
command: pages deploy

README.md

+53-24

packages/bolt/app/components/chat/Chat.client.tsx app/components/chat/Chat.client.tsx

-13
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { useChat } from 'ai/react';
44
import { useAnimate } from 'framer-motion';
55
import { memo, useEffect, useRef, useState } from 'react';
66
import { cssTransition, toast, ToastContainer } from 'react-toastify';
7-
import { AnalyticsAction, AnalyticsTrackEvent, sendAnalyticsEvent } from '~/lib/analytics';
87
import { useMessageParser, usePromptEnhancer, useShortcuts, useSnapScroll } from '~/lib/hooks';
98
import { useChatHistory } from '~/lib/persistence';
109
import { chatStore } from '~/lib/stores/chat';
@@ -195,18 +194,6 @@ export const ChatImpl = memo(({ initialMessages, storeMessageHistory }: ChatProp
195194
resetEnhancer();
196195

197196
textareaRef.current?.blur();
198-
199-
const event = messages.length === 0 ? AnalyticsTrackEvent.ChatCreated : AnalyticsTrackEvent.MessageSent;
200-
201-
sendAnalyticsEvent({
202-
action: AnalyticsAction.Track,
203-
payload: {
204-
event,
205-
properties: {
206-
message: _input,
207-
},
208-
},
209-
});
210197
};
211198

212199
const [messageRef, scrollRef] = useSnapScroll();

packages/bolt/app/components/header/HeaderActionButtons.client.tsx app/components/header/HeaderActionButtons.client.tsx

-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { useStore } from '@nanostores/react';
22
import { chatStore } from '~/lib/stores/chat';
33
import { workbenchStore } from '~/lib/stores/workbench';
44
import { classNames } from '~/utils/classNames';
5-
import { OpenStackBlitz } from './OpenStackBlitz.client';
65

76
interface HeaderActionButtonsProps {}
87

@@ -40,9 +39,6 @@ export function HeaderActionButtons({}: HeaderActionButtonsProps) {
4039
<div className="i-ph:code-bold" />
4140
</Button>
4241
</div>
43-
<div className="flex ml-2">
44-
<OpenStackBlitz />
45-
</div>
4642
</div>
4743
);
4844
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

app/lib/analytics.ts

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { CLIENT_ORIGIN } from '~/lib/constants';
2+
import { request as doRequest } from '~/lib/fetch';
3+
4+
export interface Identity {
5+
userId?: string | null;
6+
guestId?: string | null;
7+
segmentWriteKey?: string | null;
8+
avatar?: string;
9+
}
10+
11+
const MESSAGE_PREFIX = 'Bolt';
12+
13+
export enum AnalyticsTrackEvent {
14+
MessageSent = `${MESSAGE_PREFIX} Message Sent`,
15+
MessageComplete = `${MESSAGE_PREFIX} Message Complete`,
16+
ChatCreated = `${MESSAGE_PREFIX} Chat Created`,
17+
}
18+
19+
export async function identifyUser(access: string): Promise<Identity | undefined> {
20+
const response = await doRequest(`${CLIENT_ORIGIN}/api/identify`, {
21+
method: 'GET',
22+
headers: { authorization: `Bearer ${access}` },
23+
});
24+
25+
const body = await response.json();
26+
27+
if (!response.ok) {
28+
return undefined;
29+
}
30+
31+
// convert numerical identity values to strings
32+
const stringified = Object.entries(body).map(([key, value]) => [
33+
key,
34+
typeof value === 'number' ? value.toString() : value,
35+
]);
36+
37+
return Object.fromEntries(stringified) as Identity;
38+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

packages/bolt/app/lib/persistence/useChatHistory.ts app/lib/persistence/useChatHistory.ts

-11
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { useState, useEffect } from 'react';
33
import { atom } from 'nanostores';
44
import type { Message } from 'ai';
55
import { toast } from 'react-toastify';
6-
import { AnalyticsAction, sendAnalyticsEvent } from '~/lib/analytics';
76
import { workbenchStore } from '~/lib/stores/workbench';
87
import { getMessages, getNextId, getUrlId, openDatabase, setMessages } from './db';
98

@@ -107,14 +106,4 @@ function navigateChat(nextId: string) {
107106
url.pathname = `/chat/${nextId}`;
108107

109108
window.history.replaceState({}, '', url);
110-
111-
// since the `replaceState` call doesn't trigger a page reload, we need to manually log this event
112-
sendAnalyticsEvent({
113-
action: AnalyticsAction.Page,
114-
payload: {
115-
properties: {
116-
url: url.href,
117-
},
118-
},
119-
});
120109
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

packages/bolt/app/root.tsx app/root.tsx

+1-17
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import { useStore } from '@nanostores/react';
22
import type { LinksFunction } from '@remix-run/cloudflare';
3-
import { Links, Meta, Outlet, Scripts, ScrollRestoration, useLocation } from '@remix-run/react';
3+
import { Links, Meta, Outlet, Scripts, ScrollRestoration } from '@remix-run/react';
44
import tailwindReset from '@unocss/reset/tailwind-compat.css?url';
5-
import { useEffect } from 'react';
6-
import { sendAnalyticsEvent, AnalyticsAction } from './lib/analytics';
75
import { themeStore } from './lib/stores/theme';
86
import { stripIndents } from './utils/stripIndent';
97

@@ -55,20 +53,6 @@ const inlineThemeCode = stripIndents`
5553
export function Layout({ children }: { children: React.ReactNode }) {
5654
const theme = useStore(themeStore);
5755

58-
const { pathname } = useLocation();
59-
60-
// log page events when the window location changes
61-
useEffect(() => {
62-
sendAnalyticsEvent({
63-
action: AnalyticsAction.Page,
64-
payload: {
65-
properties: {
66-
url: window.location.href,
67-
},
68-
},
69-
});
70-
}, [pathname]);
71-
7256
return (
7357
<html lang="en" data-theme={theme}>
7458
<head>
File renamed without changes.

packages/bolt/app/routes/api.chat.ts app/routes/api.chat.ts

+2-15
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,21 @@ import { MAX_RESPONSE_SEGMENTS, MAX_TOKENS } from '~/lib/.server/llm/constants';
44
import { CONTINUE_PROMPT } from '~/lib/.server/llm/prompts';
55
import { streamText, type Messages, type StreamingOptions } from '~/lib/.server/llm/stream-text';
66
import SwitchableStream from '~/lib/.server/llm/switchable-stream';
7-
import type { Session } from '~/lib/.server/sessions';
8-
import { AnalyticsAction, AnalyticsTrackEvent, sendEventInternal } from '~/lib/analytics';
97

108
export async function action(args: ActionFunctionArgs) {
119
return actionWithAuth(args, chatAction);
1210
}
1311

14-
async function chatAction({ context, request }: ActionFunctionArgs, session: Session) {
12+
async function chatAction({ context, request }: ActionFunctionArgs) {
1513
const { messages } = await request.json<{ messages: Messages }>();
1614

1715
const stream = new SwitchableStream();
1816

1917
try {
2018
const options: StreamingOptions = {
2119
toolChoice: 'none',
22-
onFinish: async ({ text: content, finishReason, usage }) => {
20+
onFinish: async ({ text: content, finishReason }) => {
2321
if (finishReason !== 'length') {
24-
await sendEventInternal(session, {
25-
action: AnalyticsAction.Track,
26-
payload: {
27-
event: AnalyticsTrackEvent.MessageComplete,
28-
properties: {
29-
usage,
30-
finishReason,
31-
},
32-
},
33-
});
34-
3522
return stream.close();
3623
}
3724

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

eslint.config.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default [
2828
},
2929
{
3030
files: [...tsFileExtensions, ...jsFileExtensions, '**/*.tsx'],
31-
ignores: ['packages/bolt/functions/*'],
31+
ignores: ['functions/*'],
3232
rules: {
3333
'no-restricted-imports': [
3434
'error',
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)