@elizaos/plugin-suno 1.0.6-alpha.2 → 1.0.6-alpha.4
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/{biome.json.bak → biome.json} +8 -7
- package/dist/index.js +72 -6
- package/dist/index.js.map +1 -1
- package/package.json +6 -5
- package/src/actions/customGenerate.ts +182 -182
- package/src/actions/extend.ts +160 -160
- package/src/actions/generate.ts +171 -171
- package/src/providers/suno.ts +9 -49
- package/tsup.config.ts +1 -1
package/src/providers/suno.ts
CHANGED
|
@@ -1,29 +1,14 @@
|
|
|
1
|
-
import type { IAgentRuntime, Memory,
|
|
2
|
-
import {
|
|
1
|
+
import type { IAgentRuntime, Memory, State } from "@elizaos/core"; // Added type keyword
|
|
2
|
+
import type { Provider } from "@elizaos/core"; // Added type keyword
|
|
3
3
|
|
|
4
4
|
export interface SunoConfig {
|
|
5
5
|
apiKey: string;
|
|
6
6
|
baseUrl?: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export class SunoProvider implements Provider {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
relevanceKeywords = [
|
|
13
|
-
"suno",
|
|
14
|
-
"music",
|
|
15
|
-
"song",
|
|
16
|
-
"audio",
|
|
17
|
-
"generate",
|
|
18
|
-
"lyrics",
|
|
19
|
-
"melody",
|
|
20
|
-
"track",
|
|
21
|
-
"status",
|
|
22
|
-
"state",
|
|
23
|
-
"context",
|
|
24
|
-
];
|
|
25
|
-
private apiKey: string;
|
|
26
|
-
private baseUrl: string;
|
|
9
|
+
export class SunoProvider implements Provider {
|
|
10
|
+
private apiKey: string;
|
|
11
|
+
private baseUrl: string;
|
|
27
12
|
|
|
28
13
|
static async get(runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<SunoProvider> {
|
|
29
14
|
const apiKey = runtime.getSetting("SUNO_API_KEY");
|
|
@@ -38,34 +23,9 @@ export class SunoProvider implements Provider {
|
|
|
38
23
|
this.baseUrl = config.baseUrl || 'https://api.suno.ai/v1';
|
|
39
24
|
}
|
|
40
25
|
|
|
41
|
-
async get(_runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"music",
|
|
45
|
-
"song",
|
|
46
|
-
"audio",
|
|
47
|
-
"generate",
|
|
48
|
-
"lyrics",
|
|
49
|
-
"melody",
|
|
50
|
-
"track",
|
|
51
|
-
"status",
|
|
52
|
-
"state",
|
|
53
|
-
"context",
|
|
54
|
-
];
|
|
55
|
-
const __providerRegex = new RegExp(`\\b(${__providerKeywords.join("|")})\\b`, "i");
|
|
56
|
-
const __recentMessages = _state?.recentMessagesData || [];
|
|
57
|
-
const __isRelevant =
|
|
58
|
-
validateActionKeywords(_message, __recentMessages, __providerKeywords) ||
|
|
59
|
-
validateActionRegex(_message, __recentMessages, __providerRegex);
|
|
60
|
-
if (!__isRelevant) {
|
|
61
|
-
return { text: "" };
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return {
|
|
65
|
-
text: "Suno provider ready",
|
|
66
|
-
data: { status: "ready" },
|
|
67
|
-
};
|
|
68
|
-
}
|
|
26
|
+
async get(_runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<{ status: string }> {
|
|
27
|
+
return { status: 'ready' };
|
|
28
|
+
}
|
|
69
29
|
|
|
70
30
|
async request(endpoint: string, options: RequestInit = {}) {
|
|
71
31
|
const url = `${this.baseUrl}${endpoint}`;
|
|
@@ -115,4 +75,4 @@ export interface GenerationResponse {
|
|
|
115
75
|
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
116
76
|
audio_url?: string;
|
|
117
77
|
error?: string;
|
|
118
|
-
}
|
|
78
|
+
}
|