Usage Statistics: Multi-Turn Dialogue and Prompt Engineering for the All-in-One AI Platform

This category is compatible with FastGPT 4.10.0 and later versions. Data sources include platform API call logs, session storage modules, and

What the data for this category looks like

This category is compatible with FastGPT 4.10.0 and later versions. Data sources include platform API call logs, session storage modules, and reporting data from model call chains. Updates follow a near-real-time aggregation schedule: summary slices are generated every 5 minutes, and detail logs are written immediately after a session ends. The document structure uses structured records. Each record includes fields such as session_id, user_id, invoke_time, model_name, input_token, output_token, context_rounds, and prompt_version. Units are as follows: session identifier string, user identifier string, milliseconds, model type name, count, count, turns, and version identifier string.

Near-real-time aggregated data requires multi-turn dialogue context recall to bind to real-time link data of the current session. This prevents misalignment of usage statistics across sessions. The context_rounds field can be used to calibrate the number of context recall entries for multi-turn dialogue. This avoids inference failures caused by exceeding the model token limit. The prompt_version field requires that prompt configurations for multi-turn dialogue be associated with version identifiers. This ensures that prompt calls and usage statistics version fields for different turns match. Additionally, compliance tracing requirements in financial scenarios require that each turn of input and output in multi-turn dialogue be linked to the corresponding session usage record. Prompt parameter configurations must include session ID pass-through logic to ensure accurate data tracing.

How to set configurations

Configuration ItemRecommended ValueRationale
maxContextRoundsthe first 3-5 turnsMatches the context_rounds field of usage statistics, avoids token consumption exceeding the model limit, and ensures context relevance for multi-turn dialogue
promptVersionBindautomatically bind when a session is createdAligns with the prompt_version field of usage statistics, ensuring that prompt calls for each dialogue turn match the version identifier of the statistical data
sessionId Pass-through SwitchenabledEnsures every record of multi-turn dialogue is linked to a unique session_id, complying with usage statistics data tracing requirements
tokenThreshold80% of the model context windowCombines the input_token and output_token fields of usage statistics, preventing call failures caused by exceeding model limits
promptSpaceRecognitionenable full-width/half-width space automatic normalizationResolves statistical data deviations caused by inconsistent space formatting in prompts, and adapts to prompt recognition requirements for multi-turn dialogue
statsPersistencePath/data/fastgpt/stats (docker mount path)Ensures usage statistics data is not lost after container restarts, matching the persistence requirements of dialogue logs

The parameter values provided on this page are common starting points for configuration. Actual values are affected by material form, data volume, and business rules. Specific issues require case-by-case analysis. It is recommended to test on your own samples before finalizing settings.

Three common misconfigurations

  • Phenomenon: Only a small number of context turns are displayed in multi-turn dialogue details, and historical session content cannot be associated. Cause: The maxContextRounds configuration value is too small, and the sessionId Pass-through Switch is not enabled. This causes usage statistics to fail to correctly bind context link data for the current session.
  • Phenomenon: Half-width/full-width spaces included in prompts cannot be correctly recognized, leading to model inference results that do not match expectations. Cause: The promptSpaceRecognition configuration is not enabled, and no normalization processing is performed for spaces in prompts. This affects the accuracy of prompt version matching for usage statistics.
  • Phenomenon: Historical session usage statistics data or dialogue logs are lost, and call records cannot be traced. Cause: The docker mount parameter for statsPersistencePath is not configured. This causes data to be cleared after container restarts, and persistent storage is not implemented.

How to verify correct configuration

  • Enter the platform's usage statistics panel, filter for a specified session ID, and verify that the number of context turns for multi-turn dialogue matches the value range set in the maxContextRounds configuration.
  • Manually input prompts with different space formats to initiate multi-turn dialogue, confirm that model output matches expected logic, and verify that space recognition configuration is effective.
  • Restart the platform container, check that historical data is retained in the usage statistics panel, and confirm that persistence path configuration is correct.
  • Initiate a cross-turn dialogue, verify that the prompt_version field in session details matches the currently used prompt version.

Question material comes from public community discussions. Configuration values are common starting points and should be measured against your own samples. Verified on 2026-09-14.