Field Name | Description |
Rule Name | Set the rule name. |
Session Identifier | Select the previously configured session identifier to distinguish different users and implement precise computing power consumption detection for individual users. Note: You do not need to configure this parameter when using the SDK/API Integration method. |
Condition | By default, select the LLM business matching method and the added LLM business protection path configuration. Note: Different matching methods within a single rule are in an "AND" relationship. You do not need to configure this parameter when using the SDK/API Integration method. |
Rules | Request Frequency Protection: counts the number of requests from a single user ID within a unit of time (1 minute, 5 minutes, 10 minutes, 30 minutes, 60 minutes, 6 hours, 12 hours, 24 hours, every hour on the hour, or every natural day, with a value of 2-100000 that must be an integer). Protection Based on token Consumption: configure the total Token consumption of a single user ID within a unit of time (1 minute, 5 minutes, 10 minutes, 30 minutes, 60 minutes, 6 hours, 12 hours, 24 hours, every hour on the hour, or every natural day) based on the business type. This feature is not supported for domains connected through CLB-type WAF. |
Action | WAF supports two handling methods for users with excessive computing power consumption: Observe: log only. Block When the selected type is Request Frequency Protection: after it is detected that a user has exceeded the limit, requests sent by the user to the origin server will be blocked, and the default WAF block page will be returned. You can go to Basic Security to modify the content of the default block page. When the selected type is Protection Based on token Consumption: after detecting that a user has exceeded the limit, WAF interrupts the response from the origin server to the user and inserts custom prompt content into the returned data. You can configure the prompt content returned to the user. During WAF interception, if it is request interception, the default WAF interception prompt page is returned. You can go to Basic Security to modify the content of the default interception prompt page. If it is response interception, in addition to inserting the custom prompt content configuration into the returned data, a uuid field and uuid value are also inserted into the returned data. For a better interception experience, you can also modify the business frontend logic to adjust the actual interception effect when a uuid field is detected in the returned fields. |
Priority | Configure the rule priority. Priority logic: Enter an integer from 1 to 100. A smaller value indicates a higher execution priority for this rule. When priorities are the same, a later update time indicates a higher priority. |
if (!initResponse.ok) {const errorText = await initResponse.text();console.error('API error response:', errorText);removeMessage(responseMessageId); // Remove the message container currently displayed// Parse the error message returned by the serverlet errorMessage = '';try {const errorData = JSON.parse(errorText);errorMessage = errorData.error?.message || errorData.message || errorText;} catch (e) {errorMessage = errorText;}// Display the error message in the chat interfaceaddMessage(errorMessage, 'error');updateStatus('Request failed', 'error');return;}
// UUID detection handling - based on code logicif (parsed.uuid) {console.log('🚨 Content replacement signal detected!');console.log('Original data:', parsed);console.log('Content before replacement:', fullContent);// Extract new content from the data returned by the serverlet newContent = '';if (parsed.choices && parsed.choices[0] && parsed.choices[0].delta && parsed.choices[0].delta.content) {newContent = parsed.choices[0].delta.content;console.log('✅ Content obtained from choices[0].delta.content:', newContent);} else if (parsed.content) {newContent = parsed.content;console.log('✅ Content obtained from content:', newContent);} else {console.log('⚠️ content not found in the data');}// Completely reset the displayed contentfullContent = newContent;reasoning = '';contentWasReplaced = true;// Clear the currently displayed content and display the new content returned by the serverif (selectedModel === 'deepseek-reasoner') {// R1 mode: clear the thinking process and answer, and display new contentclearR1Message(responseMessageId);updateR1StreamingMessage(responseMessageId, '', fullContent, false);addContentReplacedIndicator(responseMessageId);} else {// Normal mode: clear messages and display new contentclearStreamingMessage(responseMessageId);updateStreamingMessage(responseMessageId, fullContent, true);addContentReplacedIndicator(responseMessageId);}console.log('✅ Content replacement completed. Current fullContent:', `"${fullContent}"`);// Stop processing subsequent data streamsshouldStopProcessing = true;console.log('🛑 Stop processing flag set. Subsequent data will not be processed');}
Field Name | Description |
Rules | Configure Protection Based on token Consumption and set the detection value to 10,000 tokens per minute. |
Action | Block. |
Use custom prompt for interception prompt | Hello, you have used a high number of tokens in the last 1 minute. Please wait for a while before using it again. |
Priority | 1. |
On/Off | On. |

フィードバック