Repository navigation
Feat/ChatApp-Work-Adjustments - #98
tumlinson-rgb wants to merge 10 commits into
Conversation
…d of declaring, disabled function default converted to dynamic toggle
…d of declaring, disabled function default converted to dynamic toggle
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
utkarsh2827
left a comment
There was a problem hiding this comment.
Quick architecture and AppFunctions review comments below. (Also [Optional]: ChatApp/wear/src/main/res/xml/app_metadata.xml still has the stale 'send' name and blank-query searchContacts guidance that was fixed in app/src/main/res/xml/app_metadata.xml — consider syncing it as well.)
| lifecycleScope.launch { | ||
| repeatOnLifecycle(Lifecycle.State.RESUMED) { | ||
| manager.handleAppFunction( | ||
| adapter.adapt { _ -> |
There was a problem hiding this comment.
adapter.adapt { _ -> true } is a silent no-op that ignores messageText and always returns true, and it registers appendDraftMessage whenever MainActivity is RESUMED (even on RecipientsScreen, AppFunctionsScreen, or CallScreen where there is no chat input bar). Consider scoping registration to ChatScreen (or routing through ChatViewModel / a shared draft state holder following unidirectional data flow) so it actually updates the active chat draft, and avoid advertising/succeeding when no chat is open.
| @OptIn(ExperimentalAppFunctionsApi::class) | ||
| @AndroidEntryPoint | ||
| class MainActivity : ComponentActivity() { | ||
| private val appFunctionManager by lazy { AppFunctionManager.getInstance(this) } |
There was a problem hiding this comment.
[Optional] AppFunctionManager.getInstance(this) is instantiated directly in MainActivity rather than injected via Hilt. Providing it through a Hilt module would improve consistency and testability.
| <property | ||
| android:name="android.app.appfunctions.app_metadata" | ||
| android:resource="@xml/app_metadata" /> | ||
| <property |
There was a problem hiding this comment.
This declares chat_activity_app_functions.xml (advertising appendDraftMessage) on Wear, but ChatApp/wear/src/main/kotlin/com/example/chatapp/wear/MainActivity.kt never calls handleAppFunction. Remove this <property> until Wear handles AppendDraftMessageSignature, or implement the handler in Wear's MainActivity.
| Operational Patterns: | ||
| - Always call 'searchContacts' first to resolve contact or group names to an 'endpointValue' before calling 'send' or 'makeCall'. | ||
| - Passing a blank query string to 'searchContacts' retrieves the most recently contacted entities. | ||
| - Always call 'searchContacts' first to resolve contact or group names to an 'endpointValue' before calling 'sendMessage', 'fetchSendMessageDetails', 'reviewSendMessage', or 'makeCall'. |
There was a problem hiding this comment.
Lines 20 and 23 reference 'reviewSendMessage', which does not exist in BaseChatAppFunctionService (removed in dbc46027), which can mislead the LLM into calling a non-existent tool. Please remove 'reviewSendMessage' here.
| } | ||
| } | ||
|
|
||
| companion object { |
There was a problem hiding this comment.
This companion object duplicates FUNCTION_ID_* constants already generated on ChatAppFunctionService (none of these are referenced), and FUNCTION_ID_REVIEW_SEND_MESSAGE (line 386) points to a removed function. Consider removing the unused companion object (or at least FUNCTION_ID_REVIEW_SEND_MESSAGE).
| endpointValue = it.id, | ||
| endpointDisplayName = it.name, | ||
| ): List<ContactSearchResult> = | ||
| withContext(Dispatchers.IO) { |
There was a problem hiding this comment.
[Optional] Hardcoding withContext(Dispatchers.IO) in each service method puts threading policy in the entry point and makes unit testing harder. Per the Guide to app architecture, consider making the repositories in data/ main-safe with an injected CoroutineDispatcher (or injecting the dispatcher via Hilt).
| ) | ||
| fun interface AppendDraftMessageSignature { | ||
| /** Appends or prefills text content into the currently active chat input bar. */ | ||
| suspend fun appendDraftMessage(messageText: String): Boolean |
There was a problem hiding this comment.
isDescribedByKDoc = true is set, so this KDoc forms the tool metadata sent to the LLM, but @param messageText and @return are missing. Please add @param messageText (clarifying blank-text behavior and append vs. replace semantics) and @return KDoc tags.
What I have done and why
--WIP--