571228d1 by Administrator

Merge branch '31531_apply_tokenization_on_other_llms' into 'master'

#1: Token count does not update on User Dashboard and Master Dashboard

See merge request !121
2 parents 25cf9790 439c4058
Pipeline #29851 for 571228d1 passed in 16 seconds
Showing 1 changed file with 20 additions and 4 deletions
......@@ -235,10 +235,18 @@ async function runGPTTurbo(req, res) {
} catch (e) {
console.log('Error encoding prompt text', e);
}
let usage_params = {
"aiwp_logged_in": aiwp_logged_in, "app": "chatbot+", "prompt_token": usage.prompt_tokens, "total_token": usage.total_tokens, "aiwp_app_id":aiwp_app_id , "usage_tries": TRIED_USAGE, ipdflu: getClientIP(req)
"aiwp_logged_in": aiwp_logged_in,
"app": "chatbot+",
"prompt_token": usage.prompt_tokens,
"total_token": usage.total_tokens,
"aiwp_app_id": aiwp_app_id,
"usage_tries": TRIED_USAGE,
ipdflu: getClientIP(req)
};
if(IS_FREE_USER) {
if (IS_FREE_USER) {
await setUsage(usage_params);
} else {
await setChatUsage(usage_params);
......@@ -330,11 +338,19 @@ async function runOpensource(req, res) {
}
} finally {
let usage_params = {
"aiwp_logged_in": aiwp_logged_in, "app": "chatbot+", "prompt_token": usage.prompt_tokens, "total_token": usage.total_tokens, "aiwp_app_id":aiwp_app_id , "usage_tries": TRIED_USAGE, ipdflu: getClientIP(req)
"aiwp_logged_in": aiwp_logged_in,
"app": "chatbot+",
"prompt_token": usage.prompt_tokens,
"total_token": usage.total_tokens,
"aiwp_app_id": aiwp_app_id,
"usage_tries": TRIED_USAGE,
ipdflu: getClientIP(req)
};
if(IS_FREE_USER) {
if (IS_FREE_USER) {
await setUsage(usage_params);
} else {
await setChatUsage(usage_params);
}
result_response = {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!