Skip to content

Commit 4fc3f0c

Browse files
authored
Merge pull request #18 from roast-dev/17-persist-roast-in-localstorage
Persist Roast conversation in `localStorage` + improve data architecture
2 parents da1cd27 + 6f1e967 commit 4fc3f0c

38 files changed

+546
-223
lines changed

.github/workflows/apps_stripe_customer_verification_publish_preview.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
jobs:
1111
deploy:
1212
runs-on: ubuntu-latest
13-
name: Deploy Preview
13+
name: Deploy to Preview
1414
defaults:
1515
run:
1616
working-directory: apps/stripe-customer-verification
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Deploy Stripe Customer Verification Worker (Production)
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
name: Deploy to Production
12+
defaults:
13+
run:
14+
working-directory: apps/stripe-customer-verification
15+
16+
steps:
17+
- name: Checkout commit
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
check-latest: true
24+
node-version: 20
25+
26+
- name: Install pnpm
27+
uses: pnpm/action-setup@v3
28+
id: pnpm-install
29+
with:
30+
version: 9
31+
run_install: false
32+
33+
- name: Get pnpm store directory
34+
id: pnpm-cache
35+
shell: bash
36+
run: |
37+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
38+
39+
- name: Setup pnpm cache
40+
uses: actions/cache@v4
41+
with:
42+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
43+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
44+
restore-keys: |
45+
${{ runner.os }}-pnpm-store-
46+
47+
- name: Install dependencies
48+
run: pnpm install
49+
50+
- name: Publish to Cloudflare Workers
51+
uses: cloudflare/wrangler-action@v3
52+
with:
53+
apiToken: ${{ secrets.CLOUDFLARE_WORKERS_API_TOKEN }}
54+
workingDirectory: apps/stripe-customer-verification
55+
command: deploy --env production

apps/browser-extension/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ node_modules
77
/.svelte-kit
88
/build
99
*.zip
10+
roast-chrome-extension
1011

1112
# OS
1213
.DS_Store

apps/browser-extension/README.md

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,35 @@
1-
# sv
1+
# Welcome to 🔥 Roast!
22

3-
Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).
3+
Thanks for trying out our beta! The stable version will be available in December 2024, but until then, let's get you set up with early access.
44

5-
## Creating a project
5+
## Quick Install Guide
66

7-
If you're seeing this, you've probably already done this step. Congrats!
7+
### 1. Install the extension from Chrome Web Store
88

9-
```bash
10-
# create a new project in the current directory
11-
npx sv create
9+
- Install the extension
10+
- After successful installation pin the extension to your favourites to have instant access to roasting!
1211

13-
# create a new project in my-app
14-
npx sv create my-app
15-
```
12+
### 2. Start Roasting! 🚀
1613

17-
## Developing
14+
1. Click the roast.dev icon
15+
2. Add your LLM API key (ChatGPT, Claude, or Gemini) in the settings
16+
3. Visit any PR on GitHub and go to "Files changed" tab
17+
4. Hit the 🔥 button for instant feedback
1818

19-
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
19+
## Good to Know
2020

21-
```bash
22-
npm run dev
21+
- Your API key and preferences are stored locally, Roast doesn't store any code or keys outside of your browser
22+
- Works with any GitHub PR you can access in your browser
2323

24-
# or start the server and open the app in a new browser tab
25-
npm run dev -- --open
26-
```
24+
## Need Help?
2725

28-
## Building
26+
Having trouble? Reach out:
2927

30-
To create a production version of your app:
28+
29+
- LinkedIn: https://linkedin.com/in/aleksander-grygier
3130

32-
```bash
33-
npm run build
34-
```
31+
Happy coding (and better PRs after roasting 🔥)!
3532

36-
You can preview the production build with `npm run preview`.
33+
---
3734

38-
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
35+
@allozaur

apps/browser-extension/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "@roast-dev/browser-extension",
3-
"version": "0.1.0",
3+
"version": "0.0.2",
44
"type": "module",
55
"scripts": {
66
"dev": "vite dev --port 5174",
7-
"build:extension": "vite build && tsc ./build/*.ts && zip -r ./roast-extension.zip ./build",
7+
"build:extension": "vite build && tsc ./build/*.ts && rm -rf ./build/*.ts && rm -rf ./roast-chrome-extension && mv ./build ./roast-chrome-extension && cp README.md roast-chrome-extension/. && zip -r ./roast-chrome-extension.zip ./roast-chrome-extension",
88
"preview": "vite preview",
99
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
1010
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export default {
2+
'claude-3-5-sonnet': 'claude-3-5-sonnet-20241022',
3+
'gpt-4o': 'gpt-4o',
4+
'gemini-1.5-pro': 'gemini-1.5-pro'
5+
};
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import type { LLMConfig, LLMProvider } from '$lib/types';
2+
import availableModels from '$lib/config/available-models';
3+
4+
const llmConfigs: Record<LLMProvider, LLMConfig> = {
5+
[availableModels['claude-3-5-sonnet']]: {
6+
endpoint: 'https://api.anthropic.com/v1/messages',
7+
headers: (apiKey) => ({
8+
'Content-Type': 'application/json',
9+
'x-api-key': apiKey,
10+
'anthropic-version': '2023-06-01',
11+
'anthropic-dangerous-direct-browser-access': 'true'
12+
}),
13+
buildBody: (messages) => ({
14+
max_tokens: 4096,
15+
messages,
16+
model: availableModels['claude-3-5-sonnet']
17+
}),
18+
extractResponse: (data) => {
19+
return { content: data.content?.[0].text, role: data?.role };
20+
}
21+
},
22+
23+
[availableModels['gpt-4o']]: {
24+
endpoint: 'https://api.openai.com/v1/chat/completions',
25+
headers: (apiKey) => ({
26+
'Content-Type': 'application/json',
27+
Authorization: `Bearer ${apiKey}`
28+
}),
29+
buildBody: (messages) => ({
30+
max_tokens: 4000,
31+
messages,
32+
model: availableModels['gpt-4o'],
33+
temperature: 0.7
34+
}),
35+
extractResponse: (data) => {
36+
return {
37+
content: data?.choices?.[0]?.message.content ?? '',
38+
role: data?.choices?.[0]?.message.role
39+
};
40+
}
41+
},
42+
43+
[availableModels['gemini-1.5-pro']]: {
44+
endpoint: `https://generativelanguage.googleapis.com/v1beta/openai/chat/completions`,
45+
headers: (apiKey) => ({
46+
'Content-Type': 'application/json',
47+
Authorization: `Bearer ${apiKey}`
48+
}),
49+
buildBody: (messages) => ({
50+
max_tokens: 4000,
51+
messages,
52+
model: availableModels['gemini-1.5-pro'],
53+
temperature: 0.7
54+
}),
55+
extractResponse: (data) => {
56+
return {
57+
content: data?.choices?.[0]?.message.content ?? '',
58+
role: data?.choices?.[0]?.message.role
59+
};
60+
}
61+
}
62+
};
63+
64+
export default llmConfigs;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export default `
2+
I've made changes in the code.
3+
4+
Please roast what's still wrong with it (and especially focus on the most important aspects), but praise the fixed or improved parts.
5+
6+
When praising be friendly but cheeky, when roasting be cocky and brilliant.
7+
8+
Also if none of the previously roasted code is changed or the changes are not sufficient, please mention that (and and have no mercy).
9+
10+
Here's the updated code:
11+
`;

0 commit comments

Comments
 (0)