Giter VIP home page Giter VIP logo

ai's Introduction

藍

An Ai for Misskey. About Ai

これなに

Misskey用の日本語Botです。

インストール

Node.js と npm と MeCab (オプション) がインストールされている必要があります。

まず適当なディレクトリに git clone します。 次にそのディレクトリに config.json を作成します。中身は次のようにします:

{
	"host": "https:// + あなたのインスタンスのURL (末尾の / は除く)",
	"i": "藍として動かしたいアカウントのアクセストークン",
	"master": "管理者のユーザー名(オプション)",
	"notingEnabled": "ランダムにノートを投稿する機能を無効にする場合は false を入れる",
	"keywordEnabled": "キーワードを覚える機能 (MeCab が必要) を有効にする場合は true を入れる (無効にする場合は false)",
	"chartEnabled": "チャート機能を無効化する場合は false を入れてください",
	"reversiEnabled": "藍とリバーシで対局できる機能を有効にする場合は true を入れる (無効にする場合は false)",
	"serverMonitoring": "サーバー監視の機能を有効にする場合は true を入れる (無効にする場合は false)",
	"checkEmojisEnabled": "カスタム絵文字チェック機能を有効にする場合は true を入れる (無効にする場合は false)",
	"checkEmojisAtOnce": "カスタム絵文字チェック機能で投稿をまとめる場合は true を入れる (まとめない場合は false)",
	"mecab": "MeCab のインストールパス (ソースからインストールした場合、大体は /usr/local/bin/mecab)",
	"mecabDic": "MeCab の辞書ファイルパス (オプション)",
	"memoryDir": "memory.jsonの保存先(オプション、デフォルトは'.'(レポジトリのルートです))"
}

npm install して npm run build して npm start すれば起動できます

Dockerで動かす

まず適当なディレクトリに git clone します。 次にそのディレクトリに config.json を作成します。中身は次のようにします: (MeCabの設定、memoryDirについては触らないでください)

{
	"host": "https:// + あなたのインスタンスのURL (末尾の / は除く)",
	"i": "藍として動かしたいアカウントのアクセストークン",
	"master": "管理者のユーザー名(オプション)",
	"notingEnabled": "ランダムにノートを投稿する機能を無効にする場合は false を入れる",
	"keywordEnabled": "キーワードを覚える機能 (MeCab が必要) を有効にする場合は true を入れる (無効にする場合は false)",
	"chartEnabled": "チャート機能を無効化する場合は false を入れてください",
	"reversiEnabled": "藍とリバーシで対局できる機能を有効にする場合は true を入れる (無効にする場合は false)",
	"serverMonitoring": "サーバー監視の機能を有効にする場合は true を入れる (無効にする場合は false)",
	"checkEmojisEnabled": "カスタム絵文字チェック機能を有効にする場合は true を入れる (無効にする場合は false)",
	"checkEmojisAtOnce": "カスタム絵文字チェック機能で投稿をまとめる場合は true を入れる (まとめない場合は false)",
	"mecab": "/usr/bin/mecab",
	"mecabDic": "/usr/lib/x86_64-linux-gnu/mecab/dic/mecab-ipadic-neologd/",
	"memoryDir": "data"
}

docker-compose build して docker-compose up すれば起動できます。 docker-compose.ymlenable_mecab0 にすると、MeCabをインストールしないようにもできます。(メモリが少ない環境など)

フォント

一部の機能にはフォントが必要です。藍にはフォントは同梱されていないので、ご自身でフォントをインストールディレクトリにfont.ttfという名前で設置してください。

記憶

藍は記憶の保持にインメモリデータベースを使用しており、藍のインストールディレクトリに memory.json という名前で永続化されます。

ライセンス

MIT

Awards

Works on my machine

ai's People

Contributors

acid-chicken avatar ebiselutica avatar eirayimiguk avatar frfs avatar h3zjp avatar imgbot[bot] avatar massongit avatar mei23 avatar na2na-p avatar nenohi avatar syuilo avatar tai-cha avatar tetsuya-ki avatar u1-liquid avatar yoshi-pc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ai's Issues

現在時刻に元ずいた挨拶をする

今の藍ちゃんは優しすぎて深夜におはようとか真昼におやすみしても丁寧に返事してくれますが、
流石に体に悪そうな言動なので心配してくれるとか(親愛度高い時)だめだめな奴だと責めてくれると(親愛度低い時?)国民の健康に貢献できそう

記憶を引継ぎというよりリンクにする

記憶の引き継ぎ機能は実装されたけど、引き継ぎというより複数アカウントで記憶がリンクされた方が使い勝手よさそう
リンクされたアカウントレコードはそれぞれ同じリンクIDを持ち、friend.save 内で同時に他のレコードも更新するようにするとか

UnhandledPromiseRejectionWarning という警告?が表示される

#10 関連?

(node:20440) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '0' of undefined
    at default_1.learn (/root/ai/built/modules/keyword/index.js:54:29)
    at processTicksAndRejections (internal/process/task_queues.js:86:5)
(node:20440) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:20440) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

devで藍ちゃんを動かしてみたものの、一応動きましたがこのエラーが表示されてしまいます。

stats

リアクションした数/された数やアカウント作成からの経過日数などを教えてくれる機能

✋がパー扱いされない

🖐はパー扱いしてくれるけど、✋がパー扱いされない。
Google IME / MS-IME は、✋をパーとして提示してくる。

WebSocketが切断されるとWait入れずにリトライしてしまう

通信エラーやサーバー側の再起動などによりWebSocketが切断されると
Wait入れずにリトライしてしまう

サーバー側のログ(1秒分):

[24/Sep/2018:13:24:27 +0900] "GET /local-timeline HTTP/1.1" 502 - 0.000 166
[24/Sep/2018:13:24:27 +0900] "GET /local-timeline HTTP/1.1" 502 - 0.000 166
[24/Sep/2018:13:24:27 +0900] "GET /local-timeline HTTP/1.1" 502 - 0.000 166
[24/Sep/2018:13:24:27 +0900] "GET /local-timeline HTTP/1.1" 502 - 0.000 166
[24/Sep/2018:13:24:27 +0900] "GET /local-timeline HTTP/1.1" 502 - 0.000 166
[24/Sep/2018:13:24:27 +0900] "GET /local-timeline HTTP/1.1" 502 - 0.000 166

上のは日本→米国で遅延があるのでかなり頻度が少ないが、国内同士やローカルだともっと多い
上のがx4ストリーム分来る

サーバー側の停止時間が長くなると、スタックがあふれてもう再接続できなくなってしまう

(node:12402) UnhandledPromiseRejectionWarning: RangeError: Maximum call stack size exceeded
    at insert (timers.js:191:5)
    at exports.active (timers.js:152:3)
    at setTimeout (timers.js:404:3)
    at resolve (/home/xxxxx/node_modules/reconnecting-websocket/dist/reconnecting-websocket-cjs.js:237:13)
    at new Promise (<anonymous>)
    at ReconnectingWebSocket._wait (/home/xxxxx/node_modules/reconnecting-websocket/dist/reconnecting-websocket-cjs.js:236:16)
    at ReconnectingWebSocket._connect (/home/xxxxx/node_modules/reconnecting-websocket/dist/reconnecting-websocket-cjs.js:274:14)
    at ReconnectingWebSocket.reconnect (/home/xxxxx/node_modules/reconnecting-websocket/dist/reconnecting-websocket-cjs.js:188:14)
    at connection.addEventListener (/home/xxxxx/built/ai.js:45:33)
    at _listeners.close.forEach.listener (/home/xxxxx/node_modules/reconnecting-websocket/dist/reconnecting-websocket-cjs.js:342:51)

やったかどうか機能

n日ごととかn曜日ごととかにやることを教えておくと、その時に○○はやりましたか?と聞いてくれる機能

睡眠時間報告

藍ちゃんが停止している状態から再度起動した時に、停止していた時間を「n時間寝てました」というフォーマットで報告する機能

テスト

テストが必要なほどの機能はないけど、APIのレスポンスをモックする方法を学ぶためにも追加したい

絵文字追加機能

藍ちゃに絵文字画像と絵文字名などの情報をユーザーが送ると、予め設定した管理者にこの絵文字を追加するかどうか尋ねに行き、了承されると藍ちゃが絵文字を追加してくれる
(藍ちゃにモデレーター権限を付与しておく必要あり)

persistedSetTimeout method

setTimeoutはメモリ上の情報なのでプロセスを再起動したりすると失われる
記憶に永続化して再起動しても有効なsetTimeoutを実現する persistedSetTimeout メソッドを実装する

Ai does not respond when close then re-open the browser to continue the game.

Steps:

  1. Start the Reversi game with Ai with default options.
  2. Close the browser after playing several steps.
  3. Open the browser and re-enter the game to resume. (Re-log in if needed.)

Actual Result:
It's Ai's turn but she doesn't continue.

Additional infomation:
This issue does not occur if turn off the option "藍が対局情報を投稿するのを許可".

Please refer to the game below for example:
https://misskey.xyz/games/reversi/5c5922a5d210ec003207cdab

藍ちゃんとPUBGがしたい

ので、OpenCVとか使ってPUBGのゲームクライアントの映像を識別して一緒にプレイできるようにしてください。

serverMonitoring機能の不具合

Traceback :

/home/misskey/aiMisskey/built/modules/server/index.js:38
            const cpuPercentages = this.statsLogs.map(s => s.cpu_usage * 100);
                                                             ^

TypeError: Cannot read property 'cpu_usage' of undefined
    at cpuPercentages.statsLogs.map.s (/home/misskey/aiMisskey/built/modules/server/index.js:38:62)
    at Array.map (<anonymous>)
    at ServerModule.check (/home/misskey/aiMisskey/built/modules/server/index.js:38:51)
    at Timeout.setInterval [as _onTimeout] (/home/misskey/aiMisskey/built/modules/server/index.js:33:22)
    at ontimeout (timers.js:436:11)
    at tryOnTimeout (timers.js:300:5)
    at listOnTimeout (timers.js:263:5)
    at Timer.processTimers (timers.js:223:10)

※データは/home/misskey/aiMisskeyに設置

なおこのエラーが出た場合、スクリプト自体停止する

node バージョンは v10.13.0

起動エラー

npm start したらエラーが発生する。

> @ start /home/misskey/aiMisskey
> node ./built

/home/misskey/aiMisskey/built/message.js:61
        if (!opts?.immediate) {
                  ^

SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:931:16)
    at Module._compile (internal/modules/cjs/loader.js:979:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
    at Module.load (internal/modules/cjs/loader.js:879:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:903:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/misskey/aiMisskey/built/ai.js:17:19)
    at Module._compile (internal/modules/cjs/loader.js:1015:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ start: `node ./built`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/misskey/.npm/_logs/2020-10-31T03_36_03_626Z-debug.log

New installation not accepting commands

We have a new install today and not working @syuilo
node v12.14.1 / npm 6.13.4 / misskey v11.37.1 (daybreak)

[Boot]: Ai v1.0
[Boot]: Account fetching... https://example.com
[Boot]: Account fetched successfully: @moderator
[Boot]: Starting AiOS...
[AiOS]: Lodaing the memory...
[AiOS]: The memory loaded successfully
[AiOS]: Installing emoji	module...
[AiOS]: Installing fortune	module...
[AiOS]: Installing guessingGame	module...
[AiOS]: Installing kazutori	module...
[AiOS]: Installing reversi	module...
[AiOS]: Installing timer	module...
[AiOS]: Installing dice	module...
[AiOS]: Installing core	module...
[AiOS]: Installing ping	module...
[AiOS]: Installing welcome	module...
[AiOS]: Installing server	module...
[AiOS]: Installing follow	module...
[AiOS]: Installing birthday	module...
[AiOS]: Installing valentine	module...
[AiOS]: Installing keyword	module...
[AiOS]: Installing maze	module...
[AiOS]: Installing chart	module...
[AiOS]: Ai am now running!

misskey-ai

Any error log to check? What's the requirement?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.