koishi-plugin-my-pig-group-friends 1.0.0
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/config.d.ts +21 -0
- package/lib/constants.d.ts +10 -0
- package/lib/database.d.ts +27 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.js +1426 -0
- package/lib/services/card.d.ts +13 -0
- package/lib/services/location.d.ts +13 -0
- package/lib/services/sunrise.d.ts +6 -0
- package/lib/services/travel.d.ts +17 -0
- package/lib/services/unsplash.d.ts +6 -0
- package/lib/types.d.ts +44 -0
- package/package.json +33 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Context } from 'koishi';
|
|
2
|
+
import { Location } from '../constants';
|
|
3
|
+
import { Config } from '../config';
|
|
4
|
+
import { UserInfo } from './travel';
|
|
5
|
+
export interface CardData {
|
|
6
|
+
location: Location;
|
|
7
|
+
msg: string;
|
|
8
|
+
}
|
|
9
|
+
export interface CardResult {
|
|
10
|
+
buffer: Buffer;
|
|
11
|
+
filename: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function generateFootprintCard(ctx: Context, config: Config, data: CardData, userInfo: UserInfo, platform: string, backgroundUrl: string | null): Promise<CardResult>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Context } from 'koishi';
|
|
2
|
+
import '../types';
|
|
3
|
+
import { Config } from '../config';
|
|
4
|
+
import { Location } from '../constants';
|
|
5
|
+
/**
|
|
6
|
+
* Generate a random location using LLM
|
|
7
|
+
* Falls back to static LOCATIONS on any error
|
|
8
|
+
*/
|
|
9
|
+
export declare function generateLocationWithLLM(ctx: Context, config: Config): Promise<Location>;
|
|
10
|
+
/**
|
|
11
|
+
* Get a random location from the static LOCATIONS array
|
|
12
|
+
*/
|
|
13
|
+
export declare function getRandomStaticLocation(): Location;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Context } from 'koishi';
|
|
2
|
+
import '../types';
|
|
3
|
+
import { Config } from '../config';
|
|
4
|
+
import { Location } from '../constants';
|
|
5
|
+
export interface TravelResult {
|
|
6
|
+
location: Location;
|
|
7
|
+
imageBuffer: Buffer | null;
|
|
8
|
+
imageUrl: string | null;
|
|
9
|
+
isAIGC: boolean;
|
|
10
|
+
msg: string;
|
|
11
|
+
}
|
|
12
|
+
export interface UserInfo {
|
|
13
|
+
userId: string;
|
|
14
|
+
username: string;
|
|
15
|
+
avatarUrl: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function triggerTravelSequence(ctx: Context, config: Config, userInfo: UserInfo, platform: string): Promise<TravelResult>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Context } from 'koishi';
|
|
2
|
+
/**
|
|
3
|
+
* Search for a photo on Unsplash and return the regular-sized URL
|
|
4
|
+
* @returns The photo URL or null if not found/error
|
|
5
|
+
*/
|
|
6
|
+
export declare function searchUnsplashPhoto(ctx: Context, accessKey: string, query: string, debug?: boolean): Promise<string | null>;
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { MediaLunaService } from 'koishi-plugin-media-luna';
|
|
2
|
+
import { Service } from 'koishi';
|
|
3
|
+
import { BaseMessage } from '@langchain/core/messages';
|
|
4
|
+
interface Puppeteer extends Service {
|
|
5
|
+
page(): Promise<any>;
|
|
6
|
+
render(html: string): Promise<string>;
|
|
7
|
+
}
|
|
8
|
+
interface TempFileInfoWithData {
|
|
9
|
+
path: string;
|
|
10
|
+
name: string;
|
|
11
|
+
type?: string;
|
|
12
|
+
expireTime: Date;
|
|
13
|
+
id: string;
|
|
14
|
+
size: number;
|
|
15
|
+
accessTime: Date;
|
|
16
|
+
accessCount: number;
|
|
17
|
+
data: Promise<Buffer>;
|
|
18
|
+
url: string;
|
|
19
|
+
}
|
|
20
|
+
interface ChatLunaStorageService extends Service {
|
|
21
|
+
createTempFile(buffer: Buffer, filename: string, expireHours?: number): Promise<TempFileInfoWithData>;
|
|
22
|
+
getTempFile(id: string): Promise<TempFileInfoWithData | null>;
|
|
23
|
+
}
|
|
24
|
+
interface ChatModel {
|
|
25
|
+
invoke(messages: BaseMessage[], options?: {
|
|
26
|
+
temperature?: number;
|
|
27
|
+
}): Promise<{
|
|
28
|
+
content: string | object;
|
|
29
|
+
}>;
|
|
30
|
+
}
|
|
31
|
+
interface ChatlunaService extends Service {
|
|
32
|
+
createChatModel(modelName: string): Promise<{
|
|
33
|
+
value: ChatModel | undefined;
|
|
34
|
+
}>;
|
|
35
|
+
}
|
|
36
|
+
declare module 'koishi' {
|
|
37
|
+
interface Context {
|
|
38
|
+
mediaLuna?: MediaLunaService;
|
|
39
|
+
puppeteer: Puppeteer;
|
|
40
|
+
chatluna_storage?: ChatLunaStorageService;
|
|
41
|
+
chatluna?: ChatlunaService;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export type { GenerationResult, OutputAsset, FileData } from 'koishi-plugin-media-luna';
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "koishi-plugin-my-pig-group-friends",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "lib/index.js",
|
|
5
|
+
"types": "lib/index.d.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"lib",
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "yakumo build"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@langchain/core": "^0.3.0",
|
|
16
|
+
"koishi-plugin-cron": "^3.1.0",
|
|
17
|
+
"koishi-thirdeye": "^11.0.0"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"koishi": "^4.17.0"
|
|
21
|
+
},
|
|
22
|
+
"koishi": {
|
|
23
|
+
"description": {
|
|
24
|
+
"zh": "我的猪群群友插件"
|
|
25
|
+
},
|
|
26
|
+
"service": {
|
|
27
|
+
"required": [
|
|
28
|
+
"database",
|
|
29
|
+
"cron"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|