initial code commit

Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
Xe Iaso 2023-04-12 09:08:06 -04:00
parent bdd4631486
commit 21132b33d4
12 changed files with 928 additions and 8 deletions

11
.dir-locals.el Normal file
View File

@ -0,0 +1,11 @@
;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")
((typescript-mode . ((typescript-indent-level . 2)
(eval . (progn
(when (fboundp 'deno-fmt-mode)
(deno-fmt-mode -1))
(when (fboundp 'prettier-js-mode)
(prettier-js-mode 1))))))
(auto-mode-alist . (("\\.tsx\\'" . typescript-tsx-mode)
("\\.mdx\\'" . markdown-mode))))

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
node_modules
.direnv
result
dist
.env

4
.husky/pre-commit Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx lint-staged

3
.prettierignore Normal file
View File

@ -0,0 +1,3 @@
result
dist
.direnv

9
.prettierrc.json Normal file
View File

@ -0,0 +1,9 @@
{
"semi": true,
"singleQuote": false,
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"trailingComma": "es5",
"bracketSpacing": true
}

View File

@ -5,4 +5,3 @@ own amusement.
> this has got to be the most elaborate way to simulate the monkey
> typewriters I've ever heard

View File

@ -11,7 +11,7 @@
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
nodejs-18_x
deno
pandoc
];
shellHook = ''
export PATH="$PATH":$(pwd)/node_modules/.bin

View File

15
index.ts Normal file
View File

@ -0,0 +1,15 @@
import * as dotenv from "dotenv";
import { Configuration, OpenAIApi } from "openai";
dotenv.config();
const configuration = new Configuration({
apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);
const completion = await openai.createChatCompletion({
model: "gpt-3.5-turbo",
messages: [{ role: "user", content: "Hello world" }],
});
console.log(completion.data.choices[0].message);

853
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -2,9 +2,11 @@
"name": "@xeserv/automuse",
"version": "0.0.1",
"description": "Xe's automatic novel generation muse using Plotto and ChatGPT",
"main": "index.js",
"main": "dist/index.js",
"scripts": {
"test": "mocha"
"start": "tsc && node dist/index.js",
"test": "mocha",
"prepare": "husky install"
},
"repository": {
"type": "git",
@ -18,9 +20,19 @@
},
"homepage": "https://github.com/Xe/automuse#readme",
"devDependencies": {
"mocha": "^10.2.0"
"@types/node": "^18.15.11",
"husky": "^8.0.3",
"lint-staged": "^13.2.1",
"mocha": "^10.2.0",
"prettier": "2.8.7",
"typescript": "^5.0.4"
},
"dependencies": {
"@xeserv/plottoriffic": "^2.2.0"
"@xeserv/plottoriffic": "^2.2.0",
"dotenv": "^16.0.3",
"openai": "^3.2.1"
},
"lint-staged": {
"*.+(js|ts|json)": "prettier --write --ignore-unknown"
}
}

16
tsconfig.json Normal file
View File

@ -0,0 +1,16 @@
{
// https://www.typescriptlang.org/tsconfig#compilerOptions
"compilerOptions": {
"esModuleInterop": true,
"lib": ["es2020", "dom"],
"module": "es2022",
"preserveConstEnums": true,
"moduleResolution": "node",
"strict": true,
"sourceMap": true,
"target": "es2022",
"types": ["node"],
"outDir": "dist"
},
"exclude": ["node_modules"]
}