|
|
|
@ -13,6 +13,7 @@ import com.yunqiinnovation.azure_speech.AzureTtsHelper |
|
|
|
import com.yunqiinnovation.open_ai_service.OpenAIService |
|
|
|
import com.yunqiinnovation.open_ai_service.SystemFunctionHandler |
|
|
|
import de.minimalme.spotify_sdk.SpotifySdkHelper |
|
|
|
import kotlinx.serialization.json.JsonObject |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -274,6 +275,17 @@ class VoiceInteractionHandler( |
|
|
|
|
|
|
|
override fun onFunctionCall(call: JSONObject) { |
|
|
|
FileLogger.d(TAG, "processWithOpenAI 收到函数调用请求: ${call.getString("name")}") |
|
|
|
// Log.e("OpenAIServicePlugin", "context:${call.toString()}") |
|
|
|
// val context = call["context"] |
|
|
|
// if (call.has("meta")) { |
|
|
|
// val meta = call.get("meta") |
|
|
|
// val metaJsonObject: JsonObject = meta as JsonObject |
|
|
|
// Log.e("OpenAIServicePlugin", "工具调用结果 context:${context} meta:${meta.toString()}") |
|
|
|
// if (metaJsonObject.containsKey("card_spotify")) { |
|
|
|
// val card_spotify:JsonObject = metaJsonObject.get("card_spotify") as JsonObject |
|
|
|
// playSpotifyMusic(card_spotify.get("name") as String) |
|
|
|
// } |
|
|
|
// } |
|
|
|
} |
|
|
|
} |
|
|
|
) |
|
|
|
|