MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / searchMusic

Method searchMusic

convert/convert.ts:95–125  ·  view source on GitHub ↗
(query: string)

Source from the content-addressed store, hash-verified

93 const url = `https://generativelanguage.googleapis.com/v1beta/models/${model}:generateContent`;
94
95 const systemPrompt = toSimplified(`You are a music information expert. Return information in the following format ONLY, without any other text:
96
97歌曲名: [Song Title]
98歌手: [Artist Name]
99专辑: [Album Name]
100
101If info is unknown, use "未知".`);
102
103 const userPrompt = toSimplified(`Find precise info for this song: '${query}'. Correct typos and find the most famous version. If not found, use user's query '${query}' as the song title.`);
104
105 const requestData = {
106 contents: [{ role: "user", parts: [{ text: userPrompt }] }],
107 systemInstruction: { parts: [{ text: systemPrompt }] },
108 tools: [{ "google_search": {} }],
109 };
110
111 try {
112 const response = await axios.post(url, requestData, {
113 headers: { "x-goog-api-key": this.apiKey, "Content-Type": "application/json" },
114 timeout: 30000,
115 });
116 return response.data?.candidates?.[0]?.content?.parts?.[0]?.text || '';
117 } catch (error: any) {
118 const errorMsg = error.response?.data?.error?.message || error.message;
119 throw new Error(`Gemini API Error: ${errorMsg}`);
120 }
121 }
122}
123
124// --- Helper Functions ---
125interface SongInfo {
126 title: string;
127 artist: string;
128 album: string;

Callers 1

handleVideoConversionMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected