mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-31 06:51:02 +00:00
feat(apis/websocket): support training without label
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import type { ClientOperation, Logger } from '@revanced/bot-shared'
|
||||
import type { Worker as TesseractWorker } from 'tesseract.js'
|
||||
import type { ClientPacketObject } from '../classes/Client'
|
||||
import type { WitMessageResponse } from '../context'
|
||||
import type { Wit } from '../context'
|
||||
import type { Config } from '../utils/config'
|
||||
|
||||
export { default as parseImageEventHandler } from './parseImage'
|
||||
@@ -14,10 +14,7 @@ export type EventHandler<POp extends ClientOperation> = (
|
||||
) => void | Promise<void>
|
||||
|
||||
export type EventContext = {
|
||||
wit: {
|
||||
train(text: string, label: string): Promise<void>
|
||||
message(text: string): Promise<WitMessageResponse>
|
||||
}
|
||||
wit: Wit
|
||||
tesseract: TesseractWorker
|
||||
logger: Logger
|
||||
config: Config
|
||||
|
||||
@@ -10,7 +10,7 @@ const trainMessageEventHandler: EventHandler<ClientOperation.TrainMessage> = asy
|
||||
const nextSeq = client.currentSequence++
|
||||
const actualText = text.slice(0, 279)
|
||||
|
||||
logger.debug(`${client.id} requested to train label ${label} (${nextSeq}) with:`, actualText)
|
||||
logger.debug(`${client.id} requested to train label ${label ?? '<out of scope>'} (${nextSeq}) with:`, actualText)
|
||||
|
||||
try {
|
||||
await wit.train(actualText, label)
|
||||
|
||||
Reference in New Issue
Block a user