MCPcopy Create free account
hub / github.com/aws/amazon-q-developer-cli / resume_todo_request

Method resume_todo_request

crates/chat-cli/src/cli/chat/mod.rs:3827–3860  ·  view source on GitHub ↗

Prompts Q to resume a to-do list with the given id by calling the load command of the todo_list tool

(&mut self, os: &mut Os, id: &str)

Source from the content-addressed store, hash-verified

3825 /// Prompts Q to resume a to-do list with the given id by calling the load
3826 /// command of the todo_list tool
3827 pub async fn resume_todo_request(&mut self, os: &mut Os, id: &str) -> Result<ChatState, ChatError> {
3828 // Have to unpack each value separately since Reports can't be converted to
3829 // ChatError
3830 let todo_list = match TodoListState::load(os, id).await {
3831 Ok(todo) => todo,
3832 Err(e) => {
3833 return Err(ChatError::Custom(format!("Error getting todo list: {e}").into()));
3834 },
3835 };
3836 let contents = match serde_json::to_string(&todo_list) {
3837 Ok(s) => s,
3838 Err(e) => return Err(ChatError::Custom(format!("Error deserializing todo list: {e}").into())),
3839 };
3840 let request_content = format!(
3841 "[SYSTEM NOTE: This is an automated request, not from the user]\n
3842 Read the TODO list contents below and understand the task description, completed tasks, and provided context.\n
3843 Call the `load` command of the todo_list tool with the given ID as an argument to display the TODO list to the user and officially resume execution of the TODO list tasks.\n
3844 You do not need to display the tasks to the user yourself. You can begin completing the tasks after calling the `load` command.\n
3845 TODO LIST CONTENTS: {}\n
3846 ID: {}\n",
3847 contents,
3848 id
3849 );
3850
3851 let summary_message = UserMessage::new_prompt(request_content.clone(), None);
3852
3853 ChatSession::reset_user_turn(self);
3854
3855 Ok(ChatState::HandleInput {
3856 input: summary_message
3857 .into_user_input_message(self.conversation.model.clone(), &self.conversation.tools)
3858 .content,
3859 })
3860 }
3861}
3862
3863/// Replaces amzn_codewhisperer_client::types::SubscriptionStatus with a more descriptive type.

Callers 1

executeMethod · 0.80

Calls 3

CustomClass · 0.85
cloneMethod · 0.45

Tested by

no test coverage detected