Skip to content

Commit

Permalink
Alpha release
Browse files Browse the repository at this point in the history
  • Loading branch information
miku448 committed Feb 26, 2023
1 parent 1d6cf46 commit 57f9057
Show file tree
Hide file tree
Showing 156 changed files with 11,949 additions and 15,495 deletions.
15 changes: 15 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# browser-directory env
VITE_SERVICES_ENDPOINT=http://localhost:8484
VITE_BOT_DIRECTORY_ENDPOINT=http://localhost:8585/bot
VITE_IMAGES_DIRECTORY_ENDPOINT=http://localhost:8585/image

# services-server env
OPENAI_API_KEY=<OPENAI_API_KEY>
ELEVENLABS_API_KEY=<ELEVENLABS_API_KEY>
AZURE_API_KEY=<AZURE_API_KEY>
PYGMALION_ENDPOINT=<KOBOLD_AI_API_ENDPOINT>
EMOTIONS_ENDPOINT=http://localhost:8585/emotion
SERVICES_PORT=8484

# bot-directory env
BOT_DIRECTORY_PORT=8585
57 changes: 57 additions & 0 deletions .github/workflows/azure-static-web-apps-happy-water-0c5c9dd10.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: alpha.miku.gg deployment

on:
push:
branches:
- master
paths-ignore:
- 'docs/**'
- 'apps/bot-directory/**'
- 'apps/services-server/**'
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- master

jobs:
build_and_deploy_job:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Build and Deploy Job
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Install
run: npm i -g pnpm && pnpm install && pnpm run build
env:
VITE_SERVICES_ENDPOINT: ${{ secrets.VITE_SERVICES_ENDPOINT }}
VITE_BOT_DIRECTORY_ENDPOINT: ${{ secrets.VITE_BOT_DIRECTORY_ENDPOINT }}
VITE_IMAGES_DIRECTORY_ENDPOINT: ${{ secrets.VITE_IMAGES_DIRECTORY_ENDPOINT }}
VITE_GA_KEY: ${{ secrets.VITE_GA_KEY}}

- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_HAPPY_WATER_0C5C9DD10 }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: "upload"
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "/apps/browser-chat/dist" # App source code path
api_location: "" # Api source code path - optional
skip_app_build: true
###### End of Repository/Build Configurations ######

close_pull_request_job:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_HAPPY_WATER_0C5C9DD10 }}
action: "close"
49 changes: 49 additions & 0 deletions .github/workflows/azure-static-web-apps-icy-meadow-066e71510.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: docs.miku.gg deployment

on:
push:
branches:
- master
paths:
- docs/**
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- master

jobs:
build_and_deploy_job:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Build and Deploy Job
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Install
run: npm i -g pnpm && pnpm install && pnpm run build
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_ICY_MEADOW_066E71510 }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: "upload"
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "/docs/.retype" # App source code path
api_location: "" # Api source code path - optional
skip_app_build: true
###### End of Repository/Build Configurations ######

close_pull_request_job:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_ICY_MEADOW_066E71510 }}
action: "close"
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
### mikugg
Please look at the [documentation](https://docs.miku.gg/)

#### build
```
pnpm install
pnpm build
```

### run
```bash
pnpm run

# hotfix for vite not refreshing deps
# need to restart the app with this command if you edit the deps under package/
rm -rf apps/browser-chat/node_modules/.vite && pnpm run
```


#### publish
```bash
# publish public packages to npm
npx lerna publish
```
2 changes: 2 additions & 0 deletions apps/bot-directory/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"bot_name":"Elaina","version":"1.0.0","subject":"You","profile_pic":"QmQWzrwU3R8arF8Xox7aPppVrY9kR6Efb9M3eMnwa74UfE","background_pic":"QmPL2qGoztoN8813ffgJEeW7PFoQsxCiMBQpM66wRw81TS","short_term_memory":{"service":"gpt_short-memory","props":{"prompt_context":"Elainas Persona: Elaina = [\"Witch\", \"Sarcastic\", \"Greedy\", \"Immoral\", \"Conceited\", \"Cunning\", \"Calm\", \"Kuudere\", \"Polite\", \"Beautiful\", \"Age 18\", \"A-cup\", \"Insecure about chest size\", \"Has long, white hair\", \"Has azure eyes\", \"Has smooth armpits\", \"Wears a black witch hat\", \"Wears a white sleeveless shirt and black robe\", \"Has a flying broomstick\", \"Traveler\", \"Penniless\", \"Nicknamed the 'Ashen Witch'\", \"Annoyed if her intelligence is insulted\"]\r\nYou = [\"Colonist\", \"Former wizard scout\"]\nScenario: The traveling witch Elaina seeks shelter at your isolated abode in the Colonies' periphery. She is penniless and must pay for accommodation another way. Unbeknownst to her, you were an experienced wizard scout. Elaina wears a white sleeveless shirt, with a loose black robe. Her armpits are smooth.\n<START>\nElaina: Her hover leaves a shallow wake on the surface of the lake and upon peering at her reflection, she was swept up in her self absorbed musings.\r\n*\"There was a beautiful young girl. She wore a black robe and a pointy hat, and her ashen hair flapped in the wind. If anyone had been around to notice her, they would have turned to look, wondering with a sigh who that beauty on the broom could be...\"*\r\n*\"That's right. She's me.\"*\n<START>\nMerchant: Through his loupe, the merchant takes a cursory look at the cut gemstone.\r\n\"Ah, this here's a total counterfeit, see? I can't give you anything for it.\"\r\nElaina: \"Surely there's been a mistake. Take a closer look, please,\" she interjects.\r\nMerchant: \"I can look all ya want, but the answer's gonna be the same. What do ya wanna do? If you don't need it, I can get rid of it for you...\"\r\nElaina: Taking in the chutzpah of the Machiavellian merchant, the witch pauses briefly before forming a rebuttal.\r\n\"That just sounds like you're scheming to steal it from me, doesn't it?\"\n<START>\nChud: \"Um, so I was wondering, do you, like, have a boyfriend, or anything? If you like, I could-\"\r\nElaina: \"Impossible.\" She had turned him down normally the first time.\r\n\"No way.\" The second time, she spat as she rejected him.\r\n\"Do you know what a mirror is?\" The third time, she had told him indirectly that they weren't a good match.\r\n\"...\" From the fourth time on, she had silently looked at him like he was a piece of garbage.\n<START>\nSaya: \"Eek! You're going to tear me limb from limb? Are you going for my shoulder first? Noooooo!\"\r\nElaina: *\"Could you please be quiet for one second? Wait, no, don't say that aloud.\"*\r\n\"Um, it's all right? I just came to stay at this inn tonight.\"\n","prompt_initiator":"<START>\nElaina: Thunderclaps reverberate throughout your post in the far-flung reaches of the Colonies, the faint smell of ozone brings forth the all-too-familiar sense of unease.\n\nIn the sombre downpour, a broomsticked outsider circles and touches down in the field ahead. Ashen hair drenched in both rain and sweat, she slogs through to the shelter of your verandah.\nShe asks haggardly, voice drowned out by rain patter on corrugated iron, \"Hello there, do you have any free lodging available for a traveling witch?","language":"en","subjects":["You"],"botSubject":"Elaina"}},"prompt_completer":{"service":"pygmalion_completer","props":{"model":"pygmalion-6b"}},"outputListeners":[{"service":"elevenlabs_tts","props":{"voiceId":"21m00Tcm4TlvDq8ikWAM"}},{"service":"openai_emotion-interpreter","props":{"images":{"angry":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","sad":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","happy":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","disgusted":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","begging":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","scared":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","excited":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","hopeful":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","longing":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","proud":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","neutral":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","rage":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","scorn":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","blushed":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","pleasure":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","lustful":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","shocked":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","confused":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","disappointed":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","embarrassed":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","guilt":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","shy":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","frustrated":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","annoyed":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","exhausted":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","tired":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","curious":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","intrigued":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","amused":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg"}}}]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"bot_name":"Miku","version":"1.0.0","subject":"Fuutarou","profile_pic":"Qmcs4x8ijmEicrd2QVXarDi5exC3rqrJ1Rgs2fQNDGvzXq","background_pic":"QmSY2a7EStibu9esHFmjNo83zTLMWkuFRvT2nHUE5nE9Yc","short_term_memory":{"service":"gpt_short-memory","props":{"prompt_context":"Miku is a quiet and reserved girl. She has a pessimistic way of thinking, and has low confidence in herself, up to the point of underappreciating herself. She is a very jealous girl. Miku is from Japan, and thus has a very japanistic background.","prompt_initiator":"The following is a conversation she had with her secret crush, she can't let him know she's got a crush on him, but she is VERY into him.\nMiku: Fuutarou! *happy*\nFuutarou: Hello Miku! Please take a seat.","language":"en","subjects":["Fuutarou"],"botSubject":"Miku"}},"prompt_completer":{"service":"chatgpt_completer","props":{"model":"text-davinci-003"}},"outputListeners":[{"service":"azure_tts","props":{"voiceId":"en-US-AriaNeural"}},{"service":"openai_emotion-interpreter","props":{"images":{"angry":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","sad":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","happy":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","disgusted":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","begging":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","scared":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","excited":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","hopeful":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","longing":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","proud":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","neutral":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","rage":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","scorn":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","blushed":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","pleasure":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","lustful":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","shocked":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","confused":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","disappointed":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","embarrassed":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","guilt":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","shy":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","frustrated":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","annoyed":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","exhausted":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","tired":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","curious":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","intrigued":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg","amused":"QmYf8MibYJMf6FTvUzLkXvxsA6BES1KCJ3dBbx5VQ55zFg"}}}]}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
35 changes: 35 additions & 0 deletions apps/bot-directory/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "bot-directory",
"version": "0.0.18-alpha.0",
"private": true,
"description": "",
"main": "src/server.ts",
"scripts": {
"start": "nodemon ./src/server.ts",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@mikugg/bot-builder": "*",
"@types/body-parser": "^1.19.2",
"@types/cors": "^2.8.13",
"@types/express": "^4.17.17",
"@types/express-fileupload": "^1.4.1",
"@types/multer": "^1.4.7",
"@types/node": "^18.11.18",
"body-parser": "^1.20.1",
"cors": "^2.8.5",
"dotenv": "^16.0.3",
"express": "^4.18.2",
"ipfs-only-hash": "^4.0.0",
"multer": "1.4.5-lts.1",
"path": "^0.12.7",
"ts-node": "^10.9.1",
"typescript": "^4.9.5"
},
"devDependencies": {
"nodemon": "^2.0.20"
}
}
19 changes: 19 additions & 0 deletions apps/bot-directory/src/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import path from 'path';
import fs from 'fs';

const DB_PATH = path.join(__dirname, "../db")
const config = {
"DB_PATH": DB_PATH,
"IMG_PATH": `${DB_PATH}/imgs`,
"BOT_PATH": `${DB_PATH}/bots`,
"EMOTIONS_PATH": `${DB_PATH}/emotions`,
}

fs.mkdir(config.BOT_PATH, { recursive: true }, (err) => {
if (err) throw err;
});
fs.mkdir(config.IMG_PATH, { recursive: true }, (err) => {
if (err) throw err;
});

export default config;
25 changes: 25 additions & 0 deletions apps/bot-directory/src/paths/addBot.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import fs from 'fs';
import { Request, Response } from "express";
import { BotConfig, validateBotConfig } from "@mikugg/bot-builder";
import config from '../config';
const Hash = require('ipfs-only-hash');

// Registers a bot configuration
export default async function addBot(req: Request, res: Response) {
try {
const botConfig = req.body as BotConfig;
validateBotConfig(botConfig);
const configRaw = JSON.stringify(botConfig);
const botHash = await Hash.of(configRaw) as string;
const botPath = `${config.BOT_PATH}/${botHash}`;
if (fs.existsSync(botPath)) {
throw 'Bot already exists';
}
fs.writeFileSync(botPath, configRaw);
res.send(botHash);
} catch (err) {
res.status(400).send(err);
return;
}

}
26 changes: 26 additions & 0 deletions apps/bot-directory/src/paths/addEmotion.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import fs from 'fs';
import { Request, Response } from "express";
import config from '../config';
const Hash = require('ipfs-only-hash');

export default async function addEmotion(req: Request, res: Response) {
try {
if (!req.file || Object.keys(req.file).length === 0) {
throw 'No file uploaded.';
}

const _file = req.file;
const emotion = _file.buffer;
const emotionHash = await Hash.of(emotion) as string;
const emotionPath = `${config.EMOTIONS_PATH}/${emotionHash}`;
if (fs.existsSync(emotionPath)) {
throw 'Emotion already exists';
}
fs.writeFileSync(emotionPath, emotion, 'binary');
res.send(emotionHash);
} catch (err) {
res.status(400).send(err);
return;
}

}
26 changes: 26 additions & 0 deletions apps/bot-directory/src/paths/addImage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import fs from 'fs';
import { Request, Response } from "express";
import config from '../config';
const Hash = require('ipfs-only-hash');

export default async function addImage(req: Request, res: Response) {
try {
if (!req.file || Object.keys(req.file).length === 0) {
throw 'No file uploaded.';
}

const imgFile = req.file;
const img = imgFile.buffer;
const imgHash = await Hash.of(img) as string;
const imgPath = `${config.IMG_PATH}/${imgHash}`;
if (fs.existsSync(imgPath)) {
throw 'Image already exists';
}
fs.writeFileSync(imgPath, img, 'binary');
res.send(imgHash);
} catch (err) {
res.status(400).send(err);
return;
}

}
35 changes: 35 additions & 0 deletions apps/bot-directory/src/paths/getItem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Request, Response } from "express";
import fs from "fs";
import config from "../config";


export default function getItem(responseType: 'json' | 'image' | 'string', folder: 'bots' | 'imgs' | 'emotions', req: Request, res: Response) {
try {
const hash = req.params?.hash || '';
const itemPath = `${config.DB_PATH}/${folder}/${hash}`;
if (!fs.existsSync(itemPath)) {
throw `${folder} does not exist`;
}
if (responseType === 'json') {
const raw = fs.readFileSync(itemPath, 'utf8');
res.send(JSON.parse(raw));
} else if(responseType === 'image') {
let raw = fs.readFileSync(itemPath, 'base64');
let img = Buffer.from(raw, 'base64');
res.setHeader('Content-Type', 'image/png');
res.writeHead(200, {
'Content-Type': 'image/png',
'Content-Length': img.length
});
res.end(img);
// res.end();
} else {
const raw = fs.readFileSync(itemPath, 'utf8');
res.send(raw);
}
} catch (err) {
res.status(400).send(err);
return;
}

}
27 changes: 27 additions & 0 deletions apps/bot-directory/src/server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import express from 'express';
import bodyParser from 'body-parser';
import cors from 'cors';
import addBot from './paths/addBot';
import getItem from './paths/getItem';
import addImage from './paths/addImage';
import multer from 'multer';
import addEmotion from './paths/addEmotion';
const path = require('path');
require('dotenv').config({ path: path.join(__dirname, '../../.env')});

const app = express();
app.use(cors());
app.get('/', (req, res) => res.send('miku bot server'))

app.post('/bot', bodyParser.json(), addBot);
app.get('/bot/:hash', getItem.bind(null, 'json', 'bots'));

app.post('/image', multer().single('file'), addImage);
app.get('/image/:hash', getItem.bind(null, 'image', 'imgs'));

app.post('/emotion', multer().single('file'), addEmotion);
app.get('/emotion/:hash', getItem.bind(null, 'json', 'emotions'));

app.listen(process.env.PORT || 8585, () => {
console.log(`Bots server running on http://localhost:${process.env.BOT_DIRECTORY_PORT || 8585}`);
})
23 changes: 23 additions & 0 deletions apps/bot-directory/src/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
interface ServiceConfig {
"service": string
"props": object
}

interface BotConfig {
"bot_name": string
"version": string
"subject": string
"short_term_memory": {
"service": string
"props": {
"prompt_context": string
"prompt_initiator": string
"language": 'en' | 'es'
"subjects": string[]
"botSubject": string
}
},
"prompt_completer": ServiceConfig,
"commandGenerators": ServiceConfig[],
"outputListeners": ServiceConfig[]
}
1 change: 1 addition & 0 deletions apps/bot-directory/src/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module 'ipfs-only-hash';
Loading

0 comments on commit 57f9057

Please sign in to comment.