From c9e06196b95bf2ad6e657a5a1f106aa011dca1cc Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Sun, 28 Sep 2025 15:49:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=80=9A=E8=AE=AF=E5=BD=95?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat_api/SystemFunctionHandler.kt | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/local_plugins/chat_api/android/src/main/kotlin/com/yunqiinnovation/chat_api/SystemFunctionHandler.kt b/local_plugins/chat_api/android/src/main/kotlin/com/yunqiinnovation/chat_api/SystemFunctionHandler.kt index 1cc996d38..c15934fc9 100644 --- a/local_plugins/chat_api/android/src/main/kotlin/com/yunqiinnovation/chat_api/SystemFunctionHandler.kt +++ b/local_plugins/chat_api/android/src/main/kotlin/com/yunqiinnovation/chat_api/SystemFunctionHandler.kt @@ -87,17 +87,7 @@ class SystemFunctionHandler(private val context: Context? = null) { description = "获取用户通信录联系人列表", parameters = mapOf( "type" to "object", - "properties" to mapOf( - "limit" to mapOf( - "type" to "integer", - "description" to "返回联系人数量限制,默认20个", - "default" to 20 - ), - "search" to mapOf( - "type" to "string", - "description" to "搜索关键词,可选参数" - ) - ), + "properties" to emptyMap(), "required" to emptyList() ), handler = GetContactsListHandler(context) @@ -1378,10 +1368,7 @@ private class GetContactsListHandler(private val context: Context?) : FunctionHa } return try { - val limit = (arguments["limit"] as? Number)?.toInt() ?: 20 - val searchKeyword = arguments["search"] as? String - - val contacts = getContactsList(context, limit, searchKeyword) + val contacts = getContactsList(context) JSONObject().apply { put("result", "成功获取联系人列表") @@ -1406,7 +1393,7 @@ private class GetContactsListHandler(private val context: Context?) : FunctionHa * @param searchKeyword 搜索关键词 * @return 联系人列表 */ - private fun getContactsList(context: Context, limit: Int, searchKeyword: String?): List> { + private fun getContactsList(context: Context): List> { val contacts = mutableListOf>() try { @@ -1433,7 +1420,7 @@ private class GetContactsListHandler(private val context: Context?) : FunctionHa val nameColumn = cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME) val hasPhoneColumn = cursor.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER) - while (cursor.moveToNext() && contacts.size < limit) { + while (cursor.moveToNext()) { val contactId = cursor.getString(idColumn) val displayName = cursor.getString(nameColumn) ?: "未知联系人" val hasPhoneNumber = cursor.getInt(hasPhoneColumn) > 0