Commit graph

99 commits

Author SHA1 Message Date
02a5b0f7b9 Remove getTime model function
it lead to higher usage of tokens.
2023-12-13 17:42:59 +01:00
722862ded3 Add shell.nix
to development util on nixos system
2023-12-13 17:06:09 +01:00
c911e567c6 Update dependencies 2023-12-13 17:04:18 +01:00
6e1cb8c956 Merge branch 'refactor/scripts' 2023-10-12 12:01:52 +02:00
a186ba9e80 scripts/pushCommands: Refactor how commands are being read
this should reduce errors when reading commands
also this won't fail if reading one command fails
2023-10-12 11:55:53 +02:00
a05047ab7d script/pushCommands: make sure the script exits 2023-09-30 14:47:10 +02:00
4729f7f563 /check-limit: rename to check-quota and change description
to match it to the new reality, limits are named quotas now

description of an option previously was longer than 100 characters
which discord api didn't like it
2023-09-30 14:46:12 +02:00
6a31473d22 scripts: move scripts to the project root directory
I believe, that these kind of scripts should reside there
instead of src directory
2023-09-30 14:46:12 +02:00
b7f6a5fe91 toOpenAIMessages: Add fallback to use user id on empty resolved name
Previously if someone named whose current mechanism
resolved to empty string ("Джо" for example)
then the openai would scream that the name
does not match their server side regex.

Meaning that the bot could not be used
in a given channel until that person
changes it's display name
or it will be forgotten for the bot.
2023-09-27 20:45:23 +02:00
ffa79e798e Fix import grouping in execution.ts
I'm silly silly bad cutie
that doesn't check commits
when I push them
2023-09-27 20:30:08 +02:00
23ceca5cd3 Update OpenAI dependency 2023-09-27 17:14:17 +02:00
8ed2e758f8 Update dependencies
OpenAI package will be updated soon,
as it needs codebase migration
2023-09-27 15:52:30 +02:00
03a1c62cd5 Execution: Stringify response error on axios error
I'm sick of not understanding the 400 problem
2023-09-26 18:17:12 +02:00
6272c7f551 /check-limit: change description of recovery-for paramteter
to mach it better for the current default behaviour
2023-09-25 11:32:52 +02:00
49b074f98e /check-limit: show when the user can use the bot again by default
fixes #12
2023-09-25 11:10:21 +02:00
80f4f18eab quota/tokenCount: allow arbitrary multipliers for tokens
I didn't notice that OpenAI changed pricing again
2023-09-25 09:58:54 +02:00
552143e345 quota/tokenCount: Rename single variable name to something that has more sense
I forgot to rename it when I commited it last time ;-;
2023-09-25 09:30:52 +02:00
94992743e8 quota/tokenCount: fix "null from a database" 2023-09-21 21:51:03 +02:00
2629659ffc Interactions: fix on failed reply to be ephemeral
fixes #17
2023-09-21 20:57:40 +02:00
96dd7bce95 Merge branch 'feature/quota' 2023-09-21 20:52:06 +02:00
18646b9dc6 config: fix imports not working correctly
this patch moves the rootDir of the typescript project up a directory
this moves all content in the dist directory inside the new src directory

I couldn't find other way
2023-09-21 20:51:38 +02:00
16fb74ec4b quota/tokenCount: Implement the "request tokens as half" case 2023-09-21 20:42:06 +02:00
4abdaebf70 quota/tokenCount: I always forget about debug logs... 2023-09-21 20:38:50 +02:00
b2ee156028 /check-limit: fix wrong unit name in field name 2023-09-21 20:08:52 +02:00
6792c05959 Quota: add tokenCount QuotaEngine 2023-09-21 20:07:35 +02:00
e194c1d81a messageCount: Add docs 2023-09-21 09:31:23 +02:00
339ef06ff9 Quota: Refactor how Quotas are being handled
also renamed limits to quota

I believe this new approach would allow me and bot hosters
to add, implement or change the quota behavior more easily.

Reimplemented the currently existing "Message count" limit
to use the new IQuota, refactoring a code *a little*.
2023-09-21 07:11:15 +02:00
46bb5c867d /summon: fix command being canceled wrongly in execution
the problem was that undefined value was compared to number,
making the expression return true
2023-09-19 20:30:55 +02:00
74fe8e3e8b Init: Remove debug logger 2023-09-18 13:33:41 +02:00
29318592b0 Execution: Don't execute the summon command if bot is writing already
fixes #14
2023-09-18 12:44:55 +02:00
b6eb476162 Fix typo again 2023-09-18 12:26:29 +02:00
1ae09945c0 Add Dockerfile 2023-09-18 11:26:37 +02:00
58a054d137 Prisma: fix typo [breaking change]
also: bump version because of breaking change
2023-09-18 11:24:35 +02:00
7ff4abc3c0 Configuration: recactor how it is written and handled 2023-09-18 11:22:10 +02:00
13e993b964 meta: change eslint styling and tsconfig project config 2023-09-18 10:41:54 +02:00
e6d6764e34 add user request limit to config, rename previous limit to read limit 2023-09-13 04:32:14 +02:00
0931fe103d Wait some time before retrying an OpenAI request
OpenAI recommended prectice is to wait some time before retrying
the request that ended with http 5xx code
the bot was not doing that before, now it does
this might fix some issues when we were retrying the request too fast
2023-08-22 21:22:18 +02:00
1205eea7af Merge branch 'fix/5' 2023-08-20 17:21:26 +02:00
c9f7e3a62e Use the request message as always newest in the model history
This may fix #5 but I am not sure
2023-08-20 15:41:39 +02:00
32dd705498 Use Iterable when converting to OpenAI messages 2023-08-20 15:12:26 +02:00
0c0cbceb46 Fix uncatched await in execution catch block
mitigates #11
2023-08-04 03:34:28 +02:00
db8628d425 Repeatedly send typing indicator while executing/generating response
fixes #10
2023-08-01 11:03:03 +02:00
d9a97cce8d Handle 5xx errors by repeating requests
the number of tries is stored in the extension of the array class
the shift method is extended to reset the number of tries
on the queue shift.

also I accidently refactored types in execution.ts
there were duplicate types declared

fixes #9
2023-07-31 21:44:03 +02:00
853bf183ee Refactor out the common error handling in moderation 2023-07-31 20:36:49 +02:00
5a116b0531 Handle almost all of the promise rejections
fixes #7
2023-07-31 12:17:14 +02:00
cf3102cbc5 Inform enduser on failed interaction 2023-07-31 12:13:29 +02:00
7225739527 Update eslintrc.json to also make it consider typings
note that I've marked Promises awaiting as a warn,
because I don't want to be bothered with it for now.

I also edited all files to accomodate with the new rules.

I should also think find a way to type-safely import Commands directory,
another time
2023-07-30 22:28:13 +02:00
c4676175ff Update dependencies 2023-07-30 21:37:37 +02:00
01231151b3 Add cache clearing of moderation requests
This removes the memory leak of not removing the moderation api cache
2023-07-30 21:28:39 +02:00
33a16bd629 Use the first character when formatting the -_- like name sequences 2023-07-30 03:00:51 +02:00