Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
tomatyss committed Jun 8, 2024
0 parents commit 8d6e2fd
Show file tree
Hide file tree
Showing 15 changed files with 2,592 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/

main.js
26 changes: 26 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"env": { "node": true },
"plugins": [
"@typescript-eslint",
"prettier"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"parserOptions": {
"sourceType": "module"
},
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
"@typescript-eslint/ban-ts-comment": "off",
"no-prototype-builtins": "off",
"@typescript-eslint/no-empty-function": "off",
"prettier/prettier": "error"
}
}
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
40 changes: 40 additions & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and Release

on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
releaseVersion:
description: 'Release Version (e.g., v1.0.0)'
required: true

jobs:
release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '21'

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GH_TOKEN }}
tag: ${{ github.event.inputs.releaseVersion || github.ref_name }}
name: Release ${{ github.event.inputs.releaseVersion || github.ref_name }}
draft: false
prerelease: false
artifacts: 'build/*'
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# vscode
.vscode

# Intellij
*.iml
.idea

# npm
node_modules

# Don't include the compiled main.js file in the repo.
# They should be uploaded to GitHub releases instead.
main.js

# Exclude sourcemaps
*.map

# obsidian
data.json

# Exclude macOS Finder (System Explorer) View States
.DS_Store
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"tabWidth": 2,
"printWidth": 80
}
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Prompt Mixer OpenAI Connector

This is a connector for Prompt Mixer that allows you to access the OpenAI API from within Prompt Mixer.

## Features
- Generate text, code, images, and more using OpenAI models
- Pass prompts and settings to the OpenAI API with just a few clicks
- Output is displayed directly in Prompt Mixer

## Installation
To install:

- In Prompt Mixer go to Settings > Connectors > Install Plugin
- Go to Settings > OpenAI to configure your API key

## Usage
After installing and configuring your API key, you can start using any OpenAI model through the assistant panel in Prompt Mixer.

Refer to the OpenAI documentation for details on how to format prompts for each model.

## Contributing
Pull requests and issues welcome! Let me know if you have any problems using the connector or ideas for improvements.

## License
MIT
25 changes: 25 additions & 0 deletions config.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export interface ModelConfig {
connectorName: string;
models: string[];
properties: Property[];
settings: Setting[];
iconBase64: string;
description?: string;
author?: string;
}

export interface Property {
id: string;
name: string;
value: string | number | boolean | string[];
type: 'string' | 'number' | 'boolean' | 'array';
}

export interface Setting {
id: string;
name: string;
value: string;
type: 'string';
}

export declare const config: ModelConfig;
96 changes: 96 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
export const config = {
connectorName: 'OpenAI WebScraper Connector',
connectorVersion: '1.0.0',
models: [
'gpt-4o',
'gpt-4o-2024-05-13',
'gpt-4-turbo',
'gpt-4-turbo-2024-04-09',
'gpt-4-0125-preview',
'gpt-4-turbo-preview',
'gpt-4-vision-preview',
'gpt-4-1106-vision-preview',
'gpt-4-1106-preview',
'gpt-4',
'gpt-4-32k',
'gpt-3.5-turbo-0125',
'gpt-3.5-turbo-1106',
'gpt-3.5-turbo',
'gpt-3.5-turbo-instruct',
],
description:
'OpenAI Connector leverage the power of advanced AI models provided by OpenAI, such as GPT',
author: 'Prompt Mixer',
properties: [
{
id: 'prompt',
name: 'System Prompt',
value: 'You are a helpful assistant.',
type: 'string',
},
{
id: 'max_tokens',
name: 'Max Tokens',
value: 4096,
type: 'number',
},
{
id: 'temperature',
name: 'Temperature',
value: 0.7,
type: 'number',
},
{
id: 'top_p',
name: 'Top P',
value: 1,
type: 'number',
},
{
id: 'frequency_penalty',
name: 'Frequency Penalty',
value: 0.5,
type: 'number',
},
{
id: 'presence_penalty',
name: 'Presence Penalty',
value: 0.5,
type: 'number',
},
{
id: 'stop',
name: 'Stop Sequences',
value: ['\n'],
type: 'array',
},
{
id: 'echo',
name: 'Echo',
value: false,
type: 'boolean',
},
{
id: 'best_of',
name: 'Best Of',
value: 1,
type: 'number',
},
{
id: 'logprobs',
name: 'LogProbs',
value: false,
type: 'boolean',
},
],
settings: [
{
id: 'API_KEY',
name: 'API Key',
value: '',
type: 'string',
},
],
iconBase64:
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAILSURBVHgB1ZPNceJAEIX5O8BNIUAEy0aAHIHZCCwisLgBF8yFv4tFBJYzsCNARLA4grUjMCcKqAL2e1s9WzLCrvLNVtXUTP/odb83PbncV//y7wU6nU41n8/fsvzj8ejhWu73+8F0On3IfRbQwOYAPWJGm81mValUAs63+BLlsD+RE43H4+cPAcMw9Pj5juTVcDhsWQEf+47jC0CxYpybrAb2RRr0DWC32w1J7ouiEnEpUeBV7BY/JioYRZEAc71e7wZ/YzQaXWQA6SIwsJbRreEOWB5AodMUu260B+oM0NfD4fDTdVlwgIVC4ZpEJSXprklOAOsD9of4TJ2T+yJbfkur/sdxBxLrbG/A9BWLRXW1YP0SAwo00VZUa9g1m4DnDKAJXXU2I+JZoX/aodODGFDgEq3nhHx8Afs9/jADSGXRuXQgpVJJM9g47ZjYAn9b3ZodI8GVi5fcoVwuR9vt9hVd1NmA6rG7dV2I0RLIguIr/O5X+b0MIMPribYEp6oEl073hJZ26zP2mWmd/nzlZCjToTT01ut15AQXkG6fXWMR4v+RRtLAE9frmTnf6WDPobOcTCZt2W6I0y+FPTTtfouRLgp5orOAqTecAPxIdWlzZS9FMxpbXp9YHTYt92rOAjpQkgMAfHM1GKH2breLkUU6X+Nrnr7hdwHPFBDdGwEbxSdWcA7se3x/AeZhVUbFkV5NAAAAAElFTkSuQmCC',
};
19 changes: 19 additions & 0 deletions esbuild.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import esbuild from 'esbuild';
import process from 'process';

const prod = process.argv[2] === 'production';

const context = await esbuild.context({
entryPoints: ['main.ts'],
bundle: true,
platform: 'node',
target: 'es2022',
outfile: './build/main.js',
});

if (prod) {
await context.rebuild();
process.exit(0);
} else {
await context.watch();
}
Loading

0 comments on commit 8d6e2fd

Please sign in to comment.