Enhance plugin functionality by adding optional provider parameters and improving thoughts extraction regex

This commit is contained in:
Kwaroran
2024-12-25 04:55:05 +09:00
parent 8b6fc5bc8b
commit 1c51afc626
5 changed files with 46 additions and 4 deletions

View File

@@ -89,7 +89,7 @@ Gets the current character.
Sets the current character.
### `addProvider(type: string, func: (arg:PluginV2ProviderArgument) => Promise<{success:boolean,content:string}>): void`
### `addProvider(type: string, func: (arg:PluginV2ProviderArgument, options?:PluginV2ProviderOptions) => Promise<{success:boolean,content:string}>): void`
Adds a provider to the plugin.
@@ -111,6 +111,9 @@ Adds a provider to the plugin.
- `Promise<{success:boolean,content:string|ReadableStream<string>}>` - The provider result.
- `success: boolean` - If the provider was successful.
- `content: string|ReadableStream<string>` - The provider content. if it's a ReadableStream, it will be streamed to the chat.
- `options?: PluginV2ProviderOptions` - The provider options.
- `tokenizer?: string` - The tokenizer name. must be one of `"mistral"`, `"llama"`, `"novelai"`, `"claude"`, `"novellist"`, `"llama3"`, `"gemma"`, `"cohere"`, `"tiktoken"` or `"custom"`. if it's `"custom"`, you have to provide `tokenizerFunc`.
- `tokenizerFunc?: (content: string) => number[]|Promise<number[]>` - The tokenizer function.
### `addRisuScriptHandler(type: string, func: (content:string) => string|null|undefined|Promise<string|null|undefined>): void`