koishi-plugin-openai-compatible 1.0.8 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -1,8 +1,71 @@
1
- import { Context } from 'koishi';
2
- import type { Config } from './config';
3
- export declare const name = "openai-compatible";
4
- export declare const inject: {
5
- required: never[];
6
- optional: never[];
7
- };
8
- export declare function apply(ctx: Context, config: Config): void;
1
+ import { Context, Logger } from 'koishi';
2
+ import { Config, EmotionType, EmojiConfig } from './types';
3
+ declare module 'koishi' {
4
+ interface Context {
5
+ openai?: OpenAICompatible;
6
+ }
7
+ }
8
+ declare class EmotionAnalyzer {
9
+ private config;
10
+ private client;
11
+ private logger;
12
+ private emotionEmojis;
13
+ private showEmotionImage;
14
+ private imageAsMarkdown;
15
+ constructor(config: Config, logger: Logger);
16
+ analyze(text: string): Promise<{
17
+ emotion: EmotionType;
18
+ emoji: string;
19
+ imageUrl?: string;
20
+ displayText: string;
21
+ success: boolean;
22
+ error?: string;
23
+ }>;
24
+ private normalizeEmotion;
25
+ private getEmojiConfig;
26
+ setEmotionEmojis(emojis: Record<string, EmojiConfig>): void;
27
+ getEmotionEmojis(): Record<string, EmojiConfig>;
28
+ getEmojiConfigForEmotion(emotion: string): EmojiConfig;
29
+ updateDisplaySettings(showImage: boolean, useMarkdown: boolean): void;
30
+ }
31
+ declare class OpenAICompatible {
32
+ private ctx;
33
+ private config;
34
+ private client;
35
+ private emotionAnalyzer;
36
+ private cooldownManager;
37
+ private logger;
38
+ constructor(ctx: Context, config: Config);
39
+ private registerService;
40
+ private registerCommand;
41
+ chat(message: string, options?: {
42
+ userId?: string;
43
+ model?: string;
44
+ temperature?: number;
45
+ systemPrompt?: string;
46
+ enableEmotion?: boolean;
47
+ showImage?: boolean;
48
+ }): Promise<{
49
+ text: string;
50
+ emotion?: EmotionType;
51
+ emoji?: string;
52
+ imageUrl?: string;
53
+ displayText?: string;
54
+ emotionSuccess?: boolean;
55
+ }>;
56
+ analyzeEmotion(text: string, showImage?: boolean): Promise<{
57
+ emotion: EmotionType;
58
+ emoji: string;
59
+ imageUrl?: string;
60
+ displayText: string;
61
+ success: boolean;
62
+ error?: string;
63
+ }>;
64
+ test(): Promise<boolean>;
65
+ getEmotionAnalyzer(): EmotionAnalyzer;
66
+ updateConfig(newConfig: Partial<Config>): void;
67
+ }
68
+ export { OpenAICompatible, Config, EmotionAnalyzer };
69
+ export * from './types';
70
+ declare const _default: (ctx: Context, config: Config) => OpenAICompatible;
71
+ export default _default;