发布

  • [NA] [BE] Add truncate parameter to thread retrieve endpoint (#3640)

    frostbyte_neo 发布于 2025-10-14 16:41:19 +00:00

    • [NA] [BE] Add truncate parameter to thread retrieve endpoint
    • Added truncate parameter to TraceThreadIdentifier

    • Updated /threads/retrieve endpoint to support truncate flag

    • Modified service and DAO layers to handle truncation

    • Updated SQL query to conditionally return full or truncated messages

    • Frontend now passes truncate: false to get complete thread messages

    This prevents large Langgraph outputs from being truncated before

    reaching the frontend prettification logic, fixing display issues

    with complex agent responses.

    • Revision 2: Fix StringTemplate escaping and thread traces truncation
    • Escape angle brackets in SELECT_TRACES_THREAD_BY_ID query only
    • Add explicit column selection in SELECT_TRACES_THREAD_BY_ID for truncated fields
    • Set truncate: false in ThreadDetailsPanel to enable message prettification

    These fixes resolve:

    1. 500 error from StringTemplate trying to parse '' in thread query
    2. 'Identifier cannot be resolved' error from missing truncated field columns
    3. Thread messages still being truncated despite truncate parameter support

    Note: Only SELECT_TRACES_THREAD_BY_ID needs escaping; other queries work without it.

    • Revision 3: Add documentation to shouldTruncate method

    Clarifies that shouldTruncate() treats both null and false as non-truncating,
    making truncation opt-in behavior. This addresses reviewer feedback about
    the method's behavior not being immediately clear from the code.

    • Fix linting

    • Add new test and tackle review comments

    下载附件