-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 757303f
Showing
73 changed files
with
8,171 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
deploy: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: "0" | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: "yarn" | ||
- name: 🚀 Deploy 🚀 | ||
run: make deploy | ||
env: | ||
API_HOST: ${{ secrets.API_HOST }} | ||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | ||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Macos | ||
.DS_Store | ||
|
||
# Editors | ||
.vscode/ | ||
.idea/ | ||
.fleet/ | ||
|
||
# Node | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Copyright (c) 2023 TJ Maynes. <tj@tjmaynes.com> | ||
|
||
Permission is hereby granted, free of charge, to any | ||
person obtaining a copy of this software and associated | ||
documentation files (the "Software"), to deal in the | ||
Software without restriction, including without | ||
limitation the rights to use, copy, modify, merge, | ||
publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software | ||
is furnished to do so, subject to the following | ||
conditions: | ||
|
||
The above copyright notice and this permission notice | ||
shall be included in all copies or substantial portions | ||
of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF | ||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED | ||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A | ||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT | ||
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR | ||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
install: | ||
yarn install | ||
cd e2e && make install | ||
|
||
dev_api: | ||
cd api && make dev | ||
|
||
dev_web: | ||
cd web && make dev | ||
|
||
start_api: | ||
cd api && make start | ||
|
||
start_web: | ||
cd web && make start | ||
|
||
start: | ||
yarn $@ | ||
|
||
dev: | ||
yarn $@ | ||
|
||
.PHONY: e2e | ||
e2e: | ||
cd e2e && make test | ||
|
||
deploy: install e2e | ||
cd api && make $@ | ||
cd web && make $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Image Analyzer App | ||
|
||
> a monorepo for a web app that analyzes images using MobileNet (in-browser) and ChatGPT (Cloudflare Workers) | ||
## Requirements | ||
|
||
- [GNU Make](https://www.gnu.org/software/make) | ||
- [Nodejs](https://nodejs.org/en/) | ||
- [Yarn](https://yarnpkg.com/) | ||
|
||
## Usage | ||
|
||
To install project dependencies, run the following command: | ||
```bash | ||
make install | ||
``` | ||
|
||
To start the application, run the following command: | ||
```bash | ||
make start | ||
``` | ||
|
||
To run `e2e` tests, run the following command: | ||
```bash | ||
make e2e | ||
``` | ||
|
||
To deploy the application, run the following command: | ||
```bash | ||
make deploy | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# src/**/*.spec.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:prettier/recommended" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": ["@typescript-eslint"], | ||
"env": { | ||
"browser": true, | ||
"node": true, | ||
"es2021": true, | ||
"jest": true | ||
}, | ||
"ignorePatterns": ["node_modules"], | ||
"overrides": [ | ||
{ | ||
"files": ["src/**/*.spec.ts"], | ||
"rules": { | ||
"@typescript-eslint/no-unused-vars": "off" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? | ||
.idea/ | ||
.fleet/ | ||
|
||
# Cloudflare | ||
.*.vars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"tabWidth": 2, | ||
"printWidth": 80, | ||
"singleQuote": true, | ||
"trailingComma": "es5", | ||
"semi": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
nodejs 18.0.0 | ||
direnv 2.32.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
start: | ||
yarn $@ | ||
|
||
dev: | ||
yarn $@ | ||
|
||
test: | ||
yarn $@ | ||
|
||
lint: | ||
yarn $@ | ||
|
||
fix: | ||
yarn lint:$@ | ||
|
||
logs: | ||
yarn $@ | ||
|
||
deploy: lint test | ||
yarn $@ | ||
|
||
ship_it: lint test | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# API | ||
|
||
> an api for talking to ChatGPT | ||
## Requirements | ||
|
||
- [GNU Make](https://www.gnu.org/software/make) | ||
- [Nodejs](https://nodejs.org/en/) | ||
- [Yarn](https://yarnpkg.com/) | ||
|
||
## Usage | ||
|
||
To install project dependencies, run the following command: | ||
|
||
```bash | ||
make install | ||
``` | ||
|
||
To run all tests, run the following command: | ||
|
||
```bash | ||
make test | ||
``` | ||
|
||
To start the application, run the following command: | ||
|
||
```bash | ||
make start | ||
``` | ||
|
||
To work on the application, run the following command: | ||
|
||
```bash | ||
make dev | ||
``` | ||
|
||
To deploy the application, run the following command: | ||
|
||
```bash | ||
make deploy | ||
``` | ||
|
||
## Notes | ||
|
||
To test `POST /conversation`, run the following command: | ||
|
||
```bash | ||
curl -v \ | ||
-H 'Content-Type: application/json' \ | ||
-d '{"context":"some-context"}' \ | ||
http://localhost:8081/conversation | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"preset": "ts-jest", | ||
"testEnvironment": "miniflare", | ||
"testMatch": ["**/src/**/(*.)+(spec|test).+(ts|tsx)"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"name": "image-analyzer-api", | ||
"private": true, | ||
"version": "0.0.0", | ||
"scripts": { | ||
"deploy": "wrangler publish src/index.ts", | ||
"dev": "wrangler dev --local", | ||
"start": "WRANGLER_SEND_METRICS=false wrangler dev src/index.ts --experimental-local", | ||
"test": "jest", | ||
"lint": "eslint .", | ||
"lint:fix": "eslint --fix .", | ||
"logs": "wrangler tail" | ||
}, | ||
"devDependencies": { | ||
"@cloudflare/workers-types": "^4.20230115.0", | ||
"@types/jest": "^29.4.0", | ||
"@typescript-eslint/eslint-plugin": "^5.51.0", | ||
"@typescript-eslint/parser": "^5.51.0", | ||
"esbuild": "^0.17.6", | ||
"esbuild-jest": "^0.5.0", | ||
"eslint": "^8.33.0", | ||
"eslint-config-node": "^4.1.0", | ||
"eslint-config-prettier": "^8.6.0", | ||
"eslint-config-typescript": "^3.0.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"jest": "^29.4.2", | ||
"jest-environment-miniflare": "^2.11.0", | ||
"miniflare": "^2.11.0", | ||
"prettier": "^2.8.3", | ||
"ts-jest": "^29.0.5", | ||
"ts-results": "^3.3.0", | ||
"typescript": "^4.9.5", | ||
"wrangler": "^2.1.14" | ||
}, | ||
"dependencies": { | ||
"@hono/graphql-server": "^0.2.0", | ||
"hono": "^2.7.6", | ||
"openai-edge": "^0.2.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { KVNamespace } from '@cloudflare/workers-types' | ||
|
||
export interface Bindings { | ||
ORIGINS: string | ||
OPENAI_API_KEY: string | ||
IMAGE_ANALYZER_DB: KVNamespace | ||
} | ||
|
||
declare global { | ||
function getMiniflareBindings(): Bindings | ||
} |
Oops, something went wrong.