Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@ubiquityos gpt command #1

Merged
merged 58 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
3de383f
chore(deps): openAi
Keyrxng Jul 12, 2024
bf8d492
chore: settings config
Keyrxng Jul 12, 2024
d8de447
chore: remove supabase
Keyrxng Jul 12, 2024
12cbcc4
feat: add commnt with diff styles
Keyrxng Jul 12, 2024
b9c1ab5
feat: simple openai chat fn
Keyrxng Jul 12, 2024
7643b3f
feat: issue related functions
Keyrxng Jul 12, 2024
bfac23d
fix: improved context issue filtering
Keyrxng Jul 12, 2024
554f3f8
chore: types and plugin entry
Keyrxng Jul 13, 2024
55d5b2a
feat: issue utils
Keyrxng Jul 13, 2024
bd790b5
feat: chat ready
Keyrxng Jul 13, 2024
6063f36
fix: cspell, eslint
Keyrxng Jul 13, 2024
1d51869
feat: ubiquibot-logger
Keyrxng Jul 13, 2024
6b0333b
fix: ignore all bot comments
Keyrxng Jul 13, 2024
a72c97b
chore: use string arrays, remove never configs
Keyrxng Jul 13, 2024
c7b6605
feat: deeper linked context fetching
Keyrxng Jul 13, 2024
94d65e5
chore: types and eslint ignore .wrangler
Keyrxng Jul 14, 2024
154a9b2
chore: simplify main handler
Keyrxng Jul 14, 2024
2b86ab2
feat: comments handler
Keyrxng Jul 14, 2024
7e6582b
chore: improved context handling
Keyrxng Jul 14, 2024
8a0a796
chore: refactor chat formatting, remove no diff error log
Keyrxng Jul 14, 2024
834a570
refactor: optimizing
Keyrxng Jul 14, 2024
c684530
chore: remove env and init tests
Keyrxng Jul 23, 2024
c08b9d0
chore: test env setup
Keyrxng Jul 23, 2024
93e9cd4
refactor: handle PluginInputs separately for better tests
Keyrxng Jul 23, 2024
042bcc0
chore: setup tests
Keyrxng Jul 23, 2024
6ce964d
chore: chat history and linked context tests
Keyrxng Jul 23, 2024
64bf785
chore: remove depth
Keyrxng Jul 23, 2024
f724b85
chore: diff comments from logs
Keyrxng Jul 23, 2024
053856e
chore: fix test
Keyrxng Jul 23, 2024
7bd0557
ci: knip
Keyrxng Jul 23, 2024
442dacb
chore: update .lock file
Keyrxng Jul 23, 2024
9f39f24
chore: fix key
Keyrxng Jul 23, 2024
8b682c8
chore: code cleanup
Keyrxng Jul 23, 2024
230abe0
chore: add another bot comment filter
Keyrxng Jul 23, 2024
f9a8aa4
chore(deps): types/jest for namespace
Keyrxng Jul 24, 2024
1fd9414
chore: eslint style and optimizing handlers
Keyrxng Jul 24, 2024
1160999
chore: unused ternary
Keyrxng Jul 24, 2024
4771e02
chore: system msg format fix
Keyrxng Jul 24, 2024
d9d440a
feat: ubiquity_os_app_slug config item
Keyrxng Sep 24, 2024
0834e09
chore: move api key into env, remove isEnabled, add manifest
Keyrxng Sep 24, 2024
de5a65c
chore: remove workflow items, correct test imports, update logger
Keyrxng Sep 24, 2024
b547300
chore: worker workflows, dotenv, utils > helpers
Keyrxng Sep 25, 2024
96f2a8b
chore: throw LogReturn and bubble up error comment
Keyrxng Sep 25, 2024
68e7938
chore: use regex for slug capture
Keyrxng Sep 25, 2024
d7ceafa
chore: refactor env var name and tests
Keyrxng Sep 25, 2024
3ca8740
chore: format
Keyrxng Sep 25, 2024
742678a
chore: slight fetch and handling improvements
Keyrxng Sep 25, 2024
1701446
chore: more robust key creation, minor fixes
Keyrxng Sep 25, 2024
c687b8b
chore: format and add hashMatch from body
Keyrxng Sep 25, 2024
7d2cc57
chore: optional chaining, try catch blocks
Keyrxng Sep 25, 2024
c498500
chore: add token usage in html comment
Keyrxng Sep 25, 2024
ef080c9
chore: typo
Keyrxng Sep 25, 2024
c4e98b6
chore: readme
Keyrxng Sep 26, 2024
48faffb
chore: camelCase and add config test
Keyrxng Sep 26, 2024
5076ec8
chore: hardcode bot name
Keyrxng Sep 26, 2024
d8bd296
chore: remove t.optional and add baseUrl check
Keyrxng Sep 26, 2024
283d6c7
chore: fix typo
Keyrxng Sep 26, 2024
6b05fdb
chore: optional endpoint, remove packageManager
Keyrxng Sep 30, 2024
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
19 changes: 18 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,24 @@
"ignorePaths": ["**/*.json", "**/*.css", "node_modules", "**/*.log", "./src/adapters/supabase/**/**.ts"],
"useGitignore": true,
"language": "en",
"words": ["Nektos", "dataurl", "devpool", "outdir", "servedir", "Supabase", "SUPABASE", "typebox", "ubiquibot", "Smee"],
"words": [
"Nektos",
"dataurl",
"devpool",
"outdir",
"servedir",
"Supabase",
"SUPABASE",
"typebox",
"ubiquibot",
"Smee",
"sonarjs",
"knip",
"mischeck",
"convo",
"ubqbot",
"behaviour"
],
"dictionaries": ["typescript", "node", "software-terms"],
"import": ["@cspell/dict-typescript/cspell-ext.json", "@cspell/dict-node/cspell-ext.json", "@cspell/dict-software-terms"],
"ignoreRegExpList": ["[0-9a-fA-F]{6}"]
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/compute.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "the name of the plugin"
name: "ubiquibot-gpt-command"
Keyrxng marked this conversation as resolved.
Show resolved Hide resolved

on:
workflow_dispatch:
Expand All @@ -18,12 +18,9 @@ on:

jobs:
compute:
name: "plugin name"
name: "gpt-command"
runs-on: ubuntu-latest
permissions: write-all
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}

steps:
- uses: actions/checkout@v4
Expand All @@ -38,7 +35,4 @@ jobs:

- name: execute directive
run: npx tsx ./src/main.ts
id: plugin-name
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
id: gpt-command
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@
"@octokit/rest": "20.1.1",
"@octokit/webhooks": "13.2.7",
"@sinclair/typebox": "0.32.33",
"@supabase/supabase-js": "2.43.5",
"@ubiquity-dao/ubiquibot-logger": "^1.3.0",
"dotenv": "16.4.5",
"openai": "^4.52.7",
"typebox-validators": "0.3.5"
},
"devDependencies": {
Expand Down Expand Up @@ -79,5 +80,6 @@
"extends": [
"@commitlint/config-conventional"
]
}
},
"packageManager": "[email protected]+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
}
17 changes: 0 additions & 17 deletions src/adapters/index.ts

This file was deleted.

49 changes: 0 additions & 49 deletions src/adapters/supabase/helpers/access.ts

This file was deleted.

52 changes: 0 additions & 52 deletions src/adapters/supabase/helpers/label.ts

This file was deleted.

12 changes: 0 additions & 12 deletions src/adapters/supabase/helpers/supabase.ts

This file was deleted.

84 changes: 0 additions & 84 deletions src/adapters/supabase/helpers/user.ts

This file was deleted.

28 changes: 28 additions & 0 deletions src/handlers/add-comment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Context } from "../types/context";

const diffStyles = {
warning: "```diff\n! ",
error: "```diff\n- ",
success: "```diff\n+ ",
info: "```diff\n# ",
};

export async function addCommentToIssue(context: Context, message: string, diff = false, diffStyle?: keyof typeof diffStyles) {
const { payload } = context;
const issueNumber = payload.issue.number;

if (diff && diffStyle) {
message = `${diffStyles[diffStyle]}${message}\n\`\`\``;
}

try {
await context.octokit.issues.createComment({
owner: payload.repository.owner.login,
repo: payload.repository.name,
issue_number: issueNumber,
body: message,
});
} catch (e: unknown) {
context.logger.error("Adding a comment failed!", { e });
}
}
Loading