Skip to content
This repository was archived by the owner on Mar 12, 2024. It is now read-only.

Commit d39664f

Browse files
Feature/add all services to gpt prompt (#213)
* Fix logging * Add notion to settings * Add notion to app * fix newline * Remove extra character * Add page image support * fix title * fix image display * fix no token error * Filter out private messages * Allow getting less than standard results * Create getHoverData.ts * fix token passing * Fix typo * Now uses commitTitle * Add new users to Sendgrid contact list * Scrub action for app * Fixes to slack matches * Fix/remove action (#178) * Delete watermelon.yml * Change dropdown link * Change login link * Change dashboard link * small fixes * Move text writers to helpers * Fix comment editing * Export helpers * Add necessary imports * Change logging * Add non-registered user response * Earlier counting of action uses * reduce logging * Add counting to comment * Add error checking * Add check for open repos * Add error writing * Extract count markdown * Fix/typings improvements (#183) * Add typings * Fix possible nulls * Add LoginGridProps type * Fix possible null * remove breaklines * Add export * Add import * Update README.md, add title (#180) * Update README.md, add title * Update README.md * Update README.md * Update README.md (#181) * Chore/codebase typings and nulls (#185) * Allow max to be 5 * check nulls * add typings * fix possible null * Add typings * Add linear link for oauth * Feature/linear (#186) * Allow max to be 5 * Create linear.tsx * Feature/linear (#187) * Allow max to be 5 * Create linear.tsx * Update linear.tsx * Add logging * improve logging * Fix linear link * Change encoding of request * Fix body of request * Fix userquery * Save user, pass team name * remove unused code * logging * try text * Create LinearLoginLink.tsx * Try new body * Update linear.tsx * Fix logo * Create linear.svg * add content type * Add linear * try fix * Fix data matching * Fix team * Removed unused link * Fix email * Feature/team and navbar (#182) * add server-only * add client-only * Move to RSC * remove logging * fix typings * fix typings * add LoginGridProps * Fix possibly null * Add types * Check nulls * fix possible nulls * ignore errors in lightly used api * Set conditionally * Check null * check null * fix typings * fix null errors * fix null * add typings * fix props passing * Add typing * Add typing * fix typings * Fix typing errors * use nonnull assertion * Add styles * Move to app folder * Adhere to app api route * Make it non default * upgrade next-auth * restore session provider * Fixes in adapter * move auth to pages to test use * Fix login route * fix import * Pass authprovider * Added sidebar test * Add sidebar * Fix navbar, extract navbar * Fix layout * Hide elements if no session * Update Navbar.tsx * Fix layout * Make app dark * Extract form * Extract navbar * Move to app * Move layout out * Remove logging * REmove logging * Move logingrid to RSC * Remove logingrid * Add layout * Remove logging * Remove logging * Create getTeammates.ts * Create Team page * Fix heading * Delete github.tsx * Move to App router * Update README.md, add title (#180) * Update README.md, add title * Update README.md * Update README.md * Update README.md (#181) * Move to RSC * Fix Try app ui * Remove data logging * Make card details a page * Move layout to master layout * Fix type * Fix layout order * Remove billing link * log response * Move back to pages * Add search params to billing page * Create loading.tsx * Get settings on load * Adde repo owner and number to charge * Pass number from param * Force prompt * fix params * Add payment success page * Add billing link to navbar * Remove text that explains repo and seats in Card Elements * Add texts that explains purchase amount * Add linear to form (#190) * Add linear to form * Add Linear to query * Create getLinear.ts * Add linear fetching * Change query to add limit * Add logging * Fix search terms * Improve logging * Update linear.ts * Add linear to app (#192) * Create linear.ts * add no token handling * Check nulls * Fix search terms * export module * Naming fixes * manage empty results * Fix text * Fix newline * Code fixes * Fix undefined team count * Add teammates (#193) * Add button * Code cleanup * Create page.tsx * Execute request on landing * fix empty teammates * fix null teammates * add logging * better logging * Fix params * Rmove logging * Get team and copy to clipboard * paralelize requests, shorten code * send correct object * Add interaction * Add plaintext to copy * Fix url * Create loading.tsx * Check for data before render * Add catch to data fetch * Fix return * Update layout.tsx * Update loading.tsx * Update loading.tsx * Update loading.tsx * Move app link up * fix button text * Glow up * Create loading.tsx * Change email to info * Create sendTeammateInvite.ts * Add emailer form * Fix template id * Fix sending handler * Move to API call * Update sendInviteForm.tsx * Update sendTeammateInvite.ts * Cleanup * Create loading.tsx * Remove params * Feature/save gh response (#194) * Add saving query * fix randomwords * Improve logging * stringify responses * Check nulls * Fix count number in log saving * Correct wm user * Extract to function (#196) * Create addActionLog.ts * Use extracted method * Reduce file size * Remove logging * Reorg imports (#197) * Reorg imports * Update github.ts * Update github.ts * Feature/extract gh action loggin (#198) * Create addActionLog.ts * Use extracted method * Reduce file size * Remove logging * fix id for team * Fix saved string * Feature/extract gh action loggin (#200) * Create addActionLog.ts * Use extracted method * Reduce file size * Remove logging * fix id for team * Fix saved string * Add replacing of apostrophe to fix query * add \n to AI summary error (#199) * add \n to AI summary error * Update github.ts * Feature/extract gh action logging (#202) * Feature/page titles (#203) * Delete sidebar.tsx (#201) * Feature/posthog analytics (#204) * Add posthogjs * Create providers.tsx * Add posthog * Add posthognode * Create posthogTracker.ts * Add tracker to gh action * make posthog early * fix list filtering * Rename tracker * Add tracker * Add tracker * Streamline data fetching * Add tracker * Feature/confluence login (#206) * Create ConfluenceLoginLink.tsx * Add confluence * Create atlassian page * Remove primer * Add primer * change link * Fix link * fix link, text * Emergency removal of posthog * REmove all posthog instances * Correct redirect uri * better logging * Update atlassian.tsx * conditionally add pic * add logging * Add discrimination to jira and confluence * Save confluence * fix link * Fix img * debug logging * Fix query * Debug logging * change grant typ * Go back a grant type * change logging * Fix url * Some more data wrangling * fix saving * Fix image * Reorg dashboard * Add coming soon ides * Style navbar better * Make sidebar sticky, add logout button * Add workspace query * Ignore name * Remove unused code * ignore calling * try other import to release * Move email to client * Change logging * fix obj accessing * Add workspace, request emails * Add email, optimize requests * fix query * Get refresh token on login * Add confluence * Improve logging * reduce logging * Better logging * Create confluence.ts * Add confluence * Fix value * Create confluence.ts * Add logging * logging * Check if null * Fix nulls * Change how tokens are updated * Rename * Fixes to query executing * Rename action * Fixes and error handling * Fix missing param * Add offline access scope * Several fixes to tokens * Logging improvements * Delete test Api * Reduce throwing * Make all unlogged services lose title * Create watermelon.ts * Use standard type * use standard types * Use standard types * Create general case helper * Make code more readable * Print full payload in this repo * Stringify full response * Allow number to be a string, like a slack channel * Add possible body * Remove data dumping * Standardize helpers * Remove unused helpers * Add possible image element * Remove unused code * use standard response * remove logging, fix text * Fix token errors in confluence * Better responses on success and failure * Check nulls * Add max results * Add limit using amount * create StandardAPIInput * Fix type * Create OptionDropdown component * Change to max 5 * Fix code * Make it component based, add confluence * Change pricing calculation and text to * Remove component unused * Fix loading page * Update README.md (#207) * Update README.md * Update README.md * Update README.md * Update README.md * Extract types * Use standard data * Add all services to GPT, upgrade to 3.5 turbo * Feature/confluence settings (#211) * Make all unlogged services lose title * Create watermelon.ts * Use standard type * use standard types * Use standard types * Create general case helper * Make code more readable * Allow number to be a string, like a slack channel * Add possible body * Standardize helpers * Remove unused helpers * Add possible image element * Remove unused code * use standard response * remove logging, fix text * Fix token errors in confluence * Better responses on success and failure * Check nulls * Add max results * Add limit using amount * create StandardAPIInput * Fix type * Create OptionDropdown component * Change to max 5 * Fix code * Make it component based, add confluence * Remove component unused * Fix loading page * Feature/standard api responses (#209) * Make all unlogged services lose title * Create watermelon.ts * Use standard type * use standard types * Use standard types * Create general case helper * Make code more readable * Allow number to be a string, like a slack channel * Add possible body * Standardize helpers * Remove unused helpers * Add possible image element * Remove unused code * use standard response * remove logging, fix text * Fix token errors in confluence * Better responses on success and failure * Check nulls * Add max results * Add limit using amount * create StandardAPIInput * Fix type * Create OptionDropdown component * Change to max 5 * Fix code * Removed unused element * Reduce code size * Add confluence * Reduce code * Further reduce code * Remove unneeded brackets * Reduce code * Remove unused code * Fix call * Remove BETA tag * Improve prompt, return content * Change how no responses look * make code more secure * Reduce length * type fixes * Fix type * Delete conflicting file --------- Co-authored-by: baristaGeek <estebanvargas94@gmail.com>
1 parent c51e14f commit d39664f

12 files changed

Lines changed: 122 additions & 125 deletions

File tree

app/layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ export default async function RootLayout({
2525
children: ReactNode;
2626
}) {
2727
const session = await getServerSession(authOptions);
28-
const userEmail = session?.user?.email;
29-
const userName = session?.user?.name;
28+
let userEmail = session?.user?.email;
29+
let userName = session?.user?.name;
3030

3131
return (
3232
<html lang="en" data-color-mode="dark" data-dark-theme="dark">

app/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ export const metadata: Metadata = {
1010
};
1111
async function HomePage() {
1212
const session = await getServerSession(authOptions);
13-
const userEmail = session?.user?.email;
14-
const userName = session?.user?.name;
13+
let userEmail = session?.user?.email;
14+
let userName = session?.user?.name;
1515
// if not logged in, do not show anything
1616
const data = await getAllPublicUserData({ userEmail }).catch((e) => {
1717
console.error(e);

app/settings/loading.tsx

Lines changed: 11 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ async function Settings({}) {
1919
ConfluenceDocs: 3,
2020
AISummary: 1,
2121
};
22-
function SettingsSelector({ label, value, defaultValue }) {
22+
function SettingsSelector({ label }) {
2323
return (
2424
<div className="">
2525
<span>{label}</span>
2626
<select
2727
className="form-select"
2828
aria-label={label}
29-
defaultValue={defaultValue}
30-
value={value}
29+
defaultValue={3}
30+
value={3}
3131
></select>
3232
</div>
3333
);
@@ -44,50 +44,21 @@ async function Settings({}) {
4444
</div>
4545
</div>
4646
<form>
47-
<SettingsSelector
48-
label="Jira Tickets"
49-
value={formState.JiraTickets}
50-
defaultValue={formState?.JiraTickets}
51-
/>
52-
<SettingsSelector
53-
label="Slack Messages"
54-
value={formState.SlackMessages}
55-
defaultValue={formState?.SlackMessages}
56-
/>
57-
<SettingsSelector
58-
label="GitHub PRs"
59-
value={formState.GitHubPRs}
60-
defaultValue={formState?.GitHubPRs}
61-
/>
62-
<SettingsSelector
63-
label="Notion Pages"
64-
value={formState.NotionPages}
65-
defaultValue={formState?.NotionPages}
66-
/>
67-
<SettingsSelector
68-
label="Linear Tickets"
69-
value={formState.LinearTickets}
70-
defaultValue={formState?.LinearTickets}
71-
/>
72-
<SettingsSelector
73-
label="Confluence Docs"
74-
value={formState.ConfluenceDocs}
75-
defaultValue={formState?.ConfluenceDocs}
76-
/>
47+
<SettingsSelector label="Jira Tickets" />
48+
<SettingsSelector label="Slack Messages" />
49+
<SettingsSelector label="GitHub PRs" />
50+
<SettingsSelector label="Notion Pages" />
51+
<SettingsSelector label="Linear Tickets" />
52+
<SettingsSelector label="Confluence Docs" />
7753

7854
<div className="">
7955
<span>AI Summary: </span>
80-
<select
81-
className="form-select"
82-
aria-label="AI Summary"
83-
defaultValue={formState?.AISummary}
84-
value={formState.AISummary}
85-
>
56+
<select className="form-select" aria-label="AI Summary" value={1}>
8657
<option value={1}>Active</option>
8758
<option value={0}>Inactive</option>
8859
</select>
8960
</div>
90-
<button className="btn btn-primary" type="button" disabled={false}>
61+
<button className="btn btn-primary" type="button" disabled={true}>
9162
{"Save"}
9263
</button>
9364
</form>

app/settings/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ export const metadata: Metadata = {
1111
};
1212
async function Settings({}) {
1313
const session = await getServerSession(authOptions);
14-
const userEmail = session?.user?.email;
15-
const userName = session?.user?.name;
14+
let userEmail = session?.user?.email;
15+
let userName = session?.user?.name;
1616
// if not logged in, do not show anything
1717
if (!session) return <LogInBtn />;
1818

app/vscode-insiders/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ export const metadata: Metadata = {
1111
};
1212
async function VSCodeInsiders() {
1313
const session = await getServerSession(authOptions);
14-
const userEmail = session?.user?.email;
15-
const userName = session?.user?.name;
14+
let userEmail = session?.user?.email;
15+
let userName = session?.user?.name;
1616
const data = await getAllPublicUserData({ userEmail });
1717

1818
let system = "vscode-insiders";

app/vscode/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ export const metadata: Metadata = {
1212
};
1313
async function VSCode() {
1414
const session = await getServerSession(authOptions);
15-
const userEmail = session?.user?.email;
16-
const userName = session?.user?.name;
15+
let userEmail = session?.user?.email;
16+
let userName = session?.user?.name;
1717
const data = await getAllPublicUserData({ userEmail });
1818
let system = "vscode";
1919
let url: string = `${system}://watermelontools.watermelon-tools?email=${

pages/api/actions/getContext.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,18 +256,21 @@ export default async function handler(req, res) {
256256
}),
257257
getJira({
258258
user: user_email,
259-
jira_token,
260-
jira_refresh_token,
259+
token: jira_token,
260+
refresh_token: jira_refresh_token,
261+
amount: 3,
261262
randomWords,
262263
}),
263264
getSlack({ title, body, slack_token, randomWords }),
264265
]);
265266

266267
const businessLogicSummary = await getOpenAISummary({
267-
ghValue,
268+
values: {
269+
ghValue,
270+
jiraValue,
271+
slackValue,
272+
},
268273
commitList,
269-
jiraValue,
270-
slackValue,
271274
title,
272275
body,
273276
});

pages/api/actions/github.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,8 @@ export default async (req, res) => {
332332
}),
333333
getJira({
334334
user: user_email,
335-
jira_token,
336-
jira_refresh_token,
335+
token: jira_token,
336+
refresh_token: jira_refresh_token,
337337
randomWords,
338338
amount: JiraTickets,
339339
}),
@@ -364,24 +364,29 @@ export default async (req, res) => {
364364
}),
365365
addActionCount({ watermelon_user }),
366366
]);
367-
textToWrite += `### WatermelonAI Summary (BETA) \n`;
367+
textToWrite += `### WatermelonAI Summary \n`;
368368

369369
let businessLogicSummary;
370370
if (AISummary) {
371371
businessLogicSummary = await getOpenAISummary({
372-
ghValue,
373372
commitList,
374-
jiraValue,
375-
slackValue,
373+
values: {
374+
ghValue,
375+
jiraValue,
376+
confluenceValue,
377+
slackValue,
378+
notionValue,
379+
linearValue,
380+
},
376381
title,
377382
body,
378383
});
379384

380385
if (businessLogicSummary) {
381-
textToWrite += businessLogicSummary;
386+
textToWrite += businessLogicSummary + "\n";
382387
} else {
383388
textToWrite +=
384-
"Error getting summary" + businessLogicSummary.error + "\n";
389+
"Error getting summary" + businessLogicSummary?.error + "\n";
385390
}
386391
} else {
387392
textToWrite += `AI Summary deactivated by ${userLogin} \n`;

types/watermelon.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,27 @@ export type MarkdownRequest = {
55
amount: number;
66
value: StandardAPIResponse;
77
};
8+
89
export type StandardAPIInput = {
910
token: string;
1011
refresh_token?: string;
11-
searchText: string;
12+
searchText?: string;
1213
amount: number;
1314
user?: string;
1415
id?: string;
1516
owner?: string;
1617
repo?: string;
1718
randomWords?: string[];
1819
};
20+
export type StandardProcessedDataArray = {
21+
title: string;
22+
body?: string;
23+
link?: string;
24+
number?: number | string;
25+
image?: string;
26+
}[];
1927
export type StandardAPIResponse = {
20-
data?: {
21-
title: string;
22-
body?: string;
23-
link?: string;
24-
number?: number | string;
25-
image?: string;
26-
}[];
28+
data?: StandardProcessedDataArray;
2729
fullData?: any;
2830
error?: string;
2931
};

utils/actions/getJira.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { StandardAPIInput } from "../../types/watermelon";
12
import getJiraOrganization from "../../utils/db/jira/getOrganization";
23
import getFreshJiraTokens from "../jira/getFreshJiraTokens";
34

@@ -46,16 +47,16 @@ async function getJiraServerInfo(jira_id, accessToken) {
4647

4748
async function getJira({
4849
user,
49-
jira_token,
50-
jira_refresh_token,
50+
token,
51+
refresh_token,
5152
randomWords,
5253
amount = 3,
53-
}) {
54-
if (!jira_token || !jira_refresh_token) return { error: "no jira token" };
54+
}: StandardAPIInput) {
55+
if (!token || !refresh_token) return { error: "no jira token" };
5556
if (!user) return { error: "no user" };
5657

5758
const newAccessTokens = await getFreshJiraTokens({
58-
jira_refresh_token,
59+
jira_refresh_token: refresh_token,
5960
user,
6061
});
6162

@@ -65,7 +66,7 @@ async function getJira({
6566
if (!jira_id) return { error: "no Jira cloudId" };
6667

6768
const cleanRandomWords = Array.from(
68-
new Set(randomWords.map((word) => removeSpecialChars(word)))
69+
new Set(randomWords?.map((word) => removeSpecialChars(word)))
6970
);
7071
const summaryQuery = cleanRandomWords
7172
.map((word) => `summary ~ "${word}"`)

0 commit comments

Comments
 (0)