Add native client with image adjustment and AI hybrid intent mode
Switch to WebView2 host with embedded resources, save chat images by order, and support buyer photo replace/delete via rules, dHash matching, and optional model-assisted intent parsing.
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
#include "Stats.h"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <mutex>
|
||||
|
||||
namespace pddai {
|
||||
|
||||
namespace {
|
||||
|
||||
std::mutex g_mutex;
|
||||
Stats::Counters g_counters;
|
||||
int g_dayKey = 0; // yyyymmdd,用于跨日归零
|
||||
|
||||
int LocalDayKey() {
|
||||
SYSTEMTIME st{};
|
||||
::GetLocalTime(&st);
|
||||
return st.wYear * 10000 + st.wMonth * 100 + st.wDay;
|
||||
}
|
||||
|
||||
void ResetIfNewDay() {
|
||||
const int key = LocalDayKey();
|
||||
if (g_dayKey != key) {
|
||||
g_dayKey = key;
|
||||
g_counters = Stats::Counters{};
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void Stats::AddReply() {
|
||||
std::lock_guard<std::mutex> lock(g_mutex);
|
||||
ResetIfNewDay();
|
||||
++g_counters.replies;
|
||||
}
|
||||
|
||||
void Stats::AddManual() {
|
||||
std::lock_guard<std::mutex> lock(g_mutex);
|
||||
ResetIfNewDay();
|
||||
++g_counters.manual;
|
||||
}
|
||||
|
||||
void Stats::AddMail() {
|
||||
std::lock_guard<std::mutex> lock(g_mutex);
|
||||
ResetIfNewDay();
|
||||
++g_counters.mails;
|
||||
}
|
||||
|
||||
void Stats::AddModelFailure() {
|
||||
std::lock_guard<std::mutex> lock(g_mutex);
|
||||
ResetIfNewDay();
|
||||
++g_counters.modelFailures;
|
||||
}
|
||||
|
||||
Stats::Counters Stats::Get() {
|
||||
std::lock_guard<std::mutex> lock(g_mutex);
|
||||
ResetIfNewDay();
|
||||
return g_counters;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user