fix: correct monitor and fix trigger billing rate limit (#28465)

This commit is contained in:
Maries 2025-11-20 20:37:10 +08:00 committed by GitHub
parent 2f9705eb6f
commit d1c9183d3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View File

@ -749,13 +749,14 @@ WHERE
""" """
Get average app interaction statistics using raw SQL for optimal performance. Get average app interaction statistics using raw SQL for optimal performance.
""" """
sql_query = """SELECT converted_created_at = convert_datetime_to_date("c.created_at")
sql_query = f"""SELECT
AVG(sub.interactions) AS interactions, AVG(sub.interactions) AS interactions,
sub.date sub.date
FROM FROM
( (
SELECT SELECT
{convert_datetime_to_date("c.created_at")} AS date, {converted_created_at} AS date,
c.created_by, c.created_by,
COUNT(c.id) AS interactions COUNT(c.id) AS interactions
FROM FROM
@ -764,8 +765,8 @@ FROM
c.tenant_id = :tenant_id c.tenant_id = :tenant_id
AND c.app_id = :app_id AND c.app_id = :app_id
AND c.triggered_from = :triggered_from AND c.triggered_from = :triggered_from
{{start}} {{{{start}}}}
{{end}} {{{{end}}}}
GROUP BY GROUP BY
date, c.created_by date, c.created_by
) sub ) sub

View File

@ -3,7 +3,7 @@ import { Plan, type PlanInfo, Priority } from '@/app/components/billing/type'
const supportModelProviders = 'OpenAI/Anthropic/Llama2/Azure OpenAI/Hugging Face/Replicate' const supportModelProviders = 'OpenAI/Anthropic/Llama2/Azure OpenAI/Hugging Face/Replicate'
export const NUM_INFINITE = 99999999 export const NUM_INFINITE = -1
export const contractSales = 'contractSales' export const contractSales = 'contractSales'
export const unAvailable = 'unAvailable' export const unAvailable = 'unAvailable'