Skip to content

步骤 4:使用会话状态添加记忆和个性化中title1部分 #1317

@EchoTouch-moon

Description

@EchoTouch-moon

Describe the bug

In the Chinese translation of the documentation, specifically in "步骤 4:使用会话状态添加记忆和个性化" (Step 4: Adding memory and personalization using session state), there is a variable name inconsistency in the provided code snippet.

The session service is incorrectly initialized as session_service_state_demo:

Python
session_service_state_demo = InMemorySessionService()
However, later in the code when creating the runner_root_stateful, it attempts to pass a variable named session_service_stateful, which is not defined:

Python
runner_root_stateful = Runner(
agent=root_agent_stateful,
app_name=APP_NAME,
session_service=session_service_stateful # This causes a NameError
)
This mismatch causes a NameError when users copy and run the code directly. The English version of the documentation is correct and uses session_service_stateful consistently.

To Reproduce

Steps to reproduce the behavior:

Go to the Chinese documentation page for the ADK (specifically the section "步骤 4:使用会话状态添加记忆和个性化").

Copy the Python code snippet provided in that section.

Run the code in a Python environment.

See error: NameError: name 'session_service_stateful' is not defined.

Expected behavior

The initialization code in the Chinese documentation should be updated to match the English version:

Python
session_service_stateful = InMemorySessionService()
This ensures the variable name is consistent with the parameter passed to the Runner class, allowing the code to execute successfully.

Screenshots

Image Image

Versions

OS: Windows 11

ADK version: latest

Python version: 3.10

Additional context

This appears to be purely a translation/localization error, as the original English documentation works perfectly. Updating the variable name in the localized markdown/doc file will fix the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions