You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error message:
google.api_core.exceptions.NotFound: 404 No document to update: projects/{project_name}/databases/(default)/documents/{collection_name}/H67iEkcHx6Nicg5eoZbmxARLyJo2_KoX4bc4jGmTKwSGLI9GBdF46Hbt2_ä¸é¤�"
The text was updated successfully, but these errors were encountered:
@on_document_updated(document="conversations/{doc_id}")
def listen_to_chat(event: Event[Change[DocumentSnapshot | None]]) -> None:
# Check if the latest message is a user response
if conversation and conversation[-1].get("role") == "user":
doc_id = event.params["doc_id"]
logger.info(f"New user response detected for document {doc_id}")
messages = [
{"role": message.get("role"), "content": message.get("content")}
for message in conversation
]
response = chat_completion(messages)
# TODO: conversation with Chinese tag ID is still broken.
event.data.after.reference.update(
{
"conversation": firestore.ArrayUnion(
[
{
"role": "assistant",
"content": response,
"timestamp": datetime.now(),
}
]
)
}
)
logger.info(f"Added response for document {doc_id}")
else:
logger.info("No new user response, no action needed.")
The error is from event.data.after.reference.update(), but I didn't manipulate the document id.
My document id:
H67iEkcHx6Nicg5eoZbmxARLyJo2_KoX4bc4jGmTKwSGLI9GBdF46Hbt2_中餐
The last two characters are Chinese characters.
Relavent code:
event.data.after.reference.update()
Error message:
google.api_core.exceptions.NotFound: 404 No document to update: projects/{project_name}/databases/(default)/documents/{collection_name}/H67iEkcHx6Nicg5eoZbmxARLyJo2_KoX4bc4jGmTKwSGLI9GBdF46Hbt2_ä¸é¤�"
The text was updated successfully, but these errors were encountered: