Chat Queue Persistence (#33)

* fix: workflow env

* update: center title on readme

* update: readme goals and format

* add: icons in readme

* fix: plus margin

* update: environment variables in contr.

* add: queue for chat history

* add: set -e for workflow failure

* update: version increment

* fix: client null info

* fix: shutoff issues
This commit is contained in:
Kevin Dang
2024-04-02 22:04:09 -07:00
committed by GitHub
parent 5f8b513269
commit 727731695e
16 changed files with 139 additions and 31 deletions

View File

@@ -1,5 +1,6 @@
import type { ClientEvents, Awaitable, Client } from 'discord.js'
import type { ClientEvents, Awaitable, Client, User } from 'discord.js'
import { Ollama } from 'ollama'
import { Queue } from '../queues/queue.js'
// Export events through here to reduce amount of imports
export { Events } from 'discord.js'
@@ -33,7 +34,7 @@ export type UserMessage = {
export interface EventProps {
client: Client
log: LogMethod
msgHist: { role: string, content: string }[]
msgHist: Queue<UserMessage>
tokens: Tokens,
ollama: Ollama
}
@@ -63,7 +64,7 @@ export function event<T extends EventKeys>(key: T, callback: EventCallback<T>):
export function registerEvents(
client: Client,
events: Event[],
msgHist: UserMessage[],
msgHist: Queue<UserMessage>,
tokens: Tokens,
ollama: Ollama
): void {