Files
msime-windows/engine/contracts/webview/messages.json
T
Jia Suiandfanlusky 2f7335be3e 统计增加首词命中率 (#963)
* feat(engine): webview 契约给统计概览增加首词命中率字段并支持 null 分支

* feat(server,ui-html): 统计新增首词命中率(决策点记录、stats v2 迁移与设置页展示)

* fix(server): 首词命中计数补日语标点排除与并发迁移复查

* fix(ui-html): 统计卡片改用自适应列宽,避免长数字被省略号截断

* fix(server,installer): 修复首词命中率随附测试在 CI 的失败

三条 server 用例是首词命中率改动新加、但从未跑绿:RawDb 在迁移用例里对尚不存在的库开只读写连接,补上 SQLITE_OPEN_CREATE;09-19 写了一次次选,按契约它是一次真实测量(0%),断言却要求 nullopt,改为断言 0.0,并把 nullopt 覆盖移到迁移用例(total==0 的那天)。安装器 preserve-user-data 从 stats_pipe.cpp 取库名,而 EnsureStatsStoreOpen 连同 stats.db 字面量已挪到 stats_candidate_capture.cpp,改到新位置。

* fix(server,ui-html): 首词命中率写库移出按键路径,修正迁移与统计口径

- 选词计数改由后台 SerialTaskRunner 写库,标点收尾与选词路径不再同步等 SQLite 锁
- 迁移以表结构为准,不再被版本号挡住;缺列时在 IMMEDIATE 事务里逐列补齐
- 标点在日期入口上收尾时按实际上屏的首条候选计数
- 五笔四码唯一自动上屏不计入;多段造词任一段非首位即不算命中
- 只有选词计数的日线不算打字日,不影响天数、日均与连续天数
- 卡片复用 formatFirstWordRatio 并展示累计命中率,概览复用 DailyRow::FirstWordRatio

---------

Co-authored-by: fanlusky <1730976608@qq.com>
2026-10-15 22:09:50 +08:00

1305 lines
26 KiB
JSON

{
"version": 1,
"client": {
"configRequest": {
"surfaces": [
"settings"
]
},
"skinCatalogRequest": {
"surfaces": [
"settings"
]
},
"openSkinDirectory": {
"surfaces": [
"settings"
]
},
"openHelpcodeDirectory": {
"surfaces": [
"settings"
]
},
"openShuangpinDirectory": {
"surfaces": [
"settings"
]
},
"collocationModelDownload": {
"surfaces": [
"settings"
],
"data": {
"type": "object",
"properties": {
"modelId": {
"type": "string"
}
},
"required": [
"modelId"
],
"additionalProperties": false
}
},
"collocationModelDelete": {
"surfaces": [
"settings"
],
"data": {
"type": "object",
"properties": {
"modelId": {
"type": "string"
}
},
"required": [
"modelId"
],
"additionalProperties": false
}
},
"collocationModelImport": {
"surfaces": [
"settings"
],
"data": {
"type": "object",
"properties": {
"modelId": {
"type": "string"
}
},
"required": [
"modelId"
],
"additionalProperties": false
}
},
"collocationModelStatusRequest": {
"surfaces": [
"settings"
]
},
"neuralModelDownload": {
"surfaces": [
"settings"
]
},
"neuralModelImport": {
"surfaces": [
"settings"
]
},
"neuralModelDelete": {
"surfaces": [
"settings"
]
},
"neuralModelStatusRequest": {
"surfaces": [
"settings"
]
},
"openHandwritingPanel": {
"surfaces": [
"settings"
]
},
"restartServer": {
"surfaces": [
"settings"
]
},
"copyText": {
"surfaces": [
"settings"
],
"data": {
"type": "string"
}
},
"openExternalUrl": {
"surfaces": [
"settings"
],
"data": {
"type": "string"
}
},
"dragStart": {
"surfaces": [
"settings",
"toolbar"
]
},
"focus": {
"surfaces": [
"settings"
]
},
"resizeStart": {
"surfaces": [
"settings"
],
"data": {
"type": "string",
"enum": [
"left",
"right",
"top",
"bottom",
"left-top",
"right-top",
"left-bottom",
"right-bottom",
"client"
]
}
},
"resizeHitTest": {
"surfaces": [
"settings"
],
"data": {
"type": "string",
"enum": [
"left",
"right",
"top",
"bottom",
"left-top",
"right-top",
"left-bottom",
"right-bottom",
"client"
]
}
},
"windowControl": {
"surfaces": [
"settings"
],
"data": {
"type": "string",
"enum": [
"minimize",
"maximize",
"restore",
"close"
]
}
},
"maximizeButtonRect": {
"surfaces": [
"settings"
],
"data": {
"type": "object",
"properties": {
"x": {
"type": "number"
},
"y": {
"type": "number"
},
"width": {
"type": "number",
"minimum": 0
},
"height": {
"type": "number",
"minimum": 0
},
"dpr": {
"type": "number",
"minimum": 0.01
}
},
"required": [
"x",
"y",
"width",
"height",
"dpr"
],
"additionalProperties": false
}
},
"configUpdate": {
"surfaces": [
"settings"
],
"data": {
"type": "object",
"properties": {
"path": {
"type": "string"
},
"value": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
}
]
}
},
"required": [
"path",
"value"
],
"additionalProperties": false
}
},
"apiCredentialTest": {
"surfaces": [
"settings"
],
"data": {
"type": "object",
"properties": {
"requestId": {
"type": "string"
},
"service": {
"type": "string",
"enum": [
"translation.tencent",
"translation.niutrans",
"translation.custom",
"translation.ai",
"voice.asr",
"voice.polish",
"ai.assistant"
]
},
"config": {
"type": "object",
"properties": {},
"required": [],
"additionalProperties": true
}
},
"required": [
"requestId",
"service",
"config"
],
"additionalProperties": false
}
},
"apiModelList": {
"surfaces": [
"settings"
],
"data": {
"type": "object",
"properties": {
"requestId": {
"type": "string"
},
"service": {
"type": "string",
"enum": [
"ai.assistant"
]
},
"config": {
"type": "object",
"properties": {},
"required": [],
"additionalProperties": true
}
},
"required": [
"requestId",
"service",
"config"
],
"additionalProperties": false
}
},
"dictionaryRequest": {
"surfaces": [
"settings"
],
"data": {
"type": "object",
"properties": {
"requestId": {
"type": "string"
},
"dictionary": {
"type": "string",
"enum": [
"quanpin",
"wubi",
"english",
"quick"
]
},
"action": {
"type": "string",
"enum": [
"query",
"create",
"update",
"delete",
"import",
"importHans",
"export"
]
},
"word": {
"type": "string"
},
"code": {
"type": "string"
},
"content": {
"type": "string"
},
"weight": {
"type": "integer"
},
"oldWord": {
"type": "string"
},
"oldCode": {
"type": "string"
},
"display": {
"type": "string"
},
"oldDisplay": {
"type": "string"
},
"offset": {
"type": "integer",
"minimum": 0,
"maximum": 2147483647
},
"limit": {
"type": "integer",
"minimum": 1,
"maximum": 200
}
},
"required": [
"requestId",
"dictionary",
"action"
],
"additionalProperties": false
}
},
"statsRequest": {
"surfaces": [
"settings"
],
"data": {
"type": "object",
"properties": {
"requestId": {
"type": "string"
},
"action": {
"type": "string",
"enum": [
"overview",
"clearAll",
"openDirectory"
]
}
},
"required": [
"requestId",
"action"
],
"additionalProperties": false
}
},
"defaultImeRequest": {
"surfaces": [
"settings"
],
"data": {
"type": "object",
"properties": {
"requestId": {
"type": "string"
},
"action": {
"type": "string",
"enum": [
"status",
"setDefault",
"openSystemSettings"
]
}
},
"required": [
"requestId",
"action"
],
"additionalProperties": false
}
},
"gameCompatRequest": {
"surfaces": [
"settings"
],
"data": {
"type": "object",
"properties": {
"requestId": {
"type": "string"
},
"action": {
"type": "string",
"enum": [
"status",
"apply"
]
},
"enabled": {
"type": "boolean"
},
"name": {
"type": "string"
}
},
"required": [
"requestId",
"action"
],
"additionalProperties": false
}
},
"openKeyboardPanel": {
"surfaces": [
"settings",
"toolbar"
]
},
"candidate": {
"surfaces": [
"candidate"
],
"data": {
"type": "integer",
"minimum": 1,
"maximum": 10
}
},
"delete": {
"surfaces": [
"candidate"
],
"data": {
"type": "integer",
"minimum": 1,
"maximum": 10
}
},
"pin": {
"surfaces": [
"candidate"
],
"data": {
"type": "integer",
"minimum": 1,
"maximum": 10
}
},
"clearPosition": {
"surfaces": [
"candidate"
],
"data": {
"type": "integer",
"minimum": 1,
"maximum": 10
}
},
"candidateWheel": {
"surfaces": [
"candidate"
],
"data": {
"type": "integer",
"minimum": -32768,
"maximum": 32767
}
},
"candidatePage": {
"surfaces": [
"candidate"
],
"data": {
"type": "string",
"enum": [
"previous",
"next"
]
}
},
"fixPosition": {
"surfaces": [
"candidate"
],
"data": {
"type": "object",
"properties": {
"index": {
"type": "integer",
"minimum": 1,
"maximum": 10
},
"position": {
"type": "integer",
"minimum": 1,
"maximum": 5
}
},
"required": [
"index",
"position"
],
"additionalProperties": false
}
},
"contextMenuResize": {
"surfaces": [
"candidate"
],
"data": {
"type": "object",
"properties": {
"width": {
"type": "integer",
"minimum": 0,
"maximum": 65535
},
"height": {
"type": "integer",
"minimum": 0,
"maximum": 65535
},
"topExpansion": {
"type": "integer",
"minimum": 0,
"maximum": 65535
},
"leftExpansion": {
"type": "integer",
"minimum": 0,
"maximum": 65535
}
},
"required": [
"width",
"height"
],
"additionalProperties": false
}
},
"contextMenuClosed": {
"surfaces": [
"candidate"
]
},
"candidatePointerArmed": {
"surfaces": [
"candidate"
]
},
"candidatePointerMotion": {
"surfaces": [
"candidate"
]
},
"candidateFrameProbe": {
"surfaces": [
"candidate"
],
"data": {
"type": "object",
"properties": {
"revision": {
"type": "integer"
},
"stage": {
"type": "integer"
},
"performanceMs": {
"type": "number",
"minimum": 0
}
},
"required": [
"revision",
"stage",
"performanceMs"
],
"additionalProperties": false
}
},
"candidatePointerProbe": {
"surfaces": [
"candidate"
],
"data": {
"type": "object",
"properties": {
"probe": {
"type": "integer"
},
"screenX": {
"type": "integer"
},
"screenY": {
"type": "integer"
},
"clientX": {
"type": "integer"
},
"clientY": {
"type": "integer"
},
"movementX": {
"type": "integer"
},
"movementY": {
"type": "integer"
},
"armed": {
"type": "boolean"
}
},
"required": [
"probe",
"screenX",
"screenY",
"clientX",
"clientY",
"movementX",
"movementY",
"armed"
],
"additionalProperties": false
}
},
"contentTruncated": {
"surfaces": [
"candidate",
"toolbar",
"menu"
],
"data": {
"type": "object",
"properties": {
"surface": {
"type": "string",
"enum": [
"candidate",
"toolbar",
"menu",
"ftb",
"candwnd",
"cand"
]
},
"width": {
"type": "number",
"minimum": 0
},
"height": {
"type": "number",
"minimum": 0
}
},
"required": [
"surface",
"width",
"height"
],
"additionalProperties": true
}
},
"floatingToggle": {
"surfaces": [
"menu"
],
"data": {
"type": "boolean"
}
},
"settings": {
"surfaces": [
"menu"
]
},
"about": {
"surfaces": [
"menu"
]
},
"emojiSymbols": {
"surfaces": [
"menu"
]
},
"keyboardPanel": {
"surfaces": [
"menu"
]
},
"handwritingPanel": {
"surfaces": [
"menu"
]
},
"voiceInput": {
"surfaces": [
"menu"
]
},
"changeInputScheme": {
"surfaces": [
"menu"
],
"data": {
"type": "string",
"enum": [
"quanpin",
"shuangpin",
"wubi"
]
}
},
"inputSchemeSubmenu": {
"surfaces": [
"menu"
],
"data": {
"type": "object",
"properties": {
"open": {
"type": "boolean"
},
"width": {
"type": "number",
"minimum": 0
}
},
"required": [
"open",
"width"
],
"additionalProperties": false
}
},
"ready": {
"surfaces": [
"toolbar"
]
},
"exitEnglishInputMode": {
"surfaces": [
"toolbar"
]
},
"changeCharacterSet": {
"surfaces": [
"toolbar"
]
},
"openSettings": {
"surfaces": [
"toolbar"
]
},
"openEmojiPanel": {
"surfaces": [
"toolbar"
]
},
"changeIMEMode": {
"surfaces": [
"toolbar"
],
"data": {
"type": "string",
"enum": [
"cn",
"en"
]
}
},
"changeCharMode": {
"surfaces": [
"toolbar"
],
"data": {
"type": "string",
"enum": [
"fullwidth",
"halfwidth"
]
}
},
"changePuncMode": {
"surfaces": [
"toolbar"
],
"data": {
"type": "string",
"enum": [
"puncEn",
"puncCn"
]
}
}
},
"server": {
"configSnapshot": {
"data": {
"type": "object",
"properties": {},
"required": [],
"additionalProperties": true
}
},
"windowState": {
"data": {
"type": "object",
"properties": {
"isMaximized": {
"type": "boolean"
}
},
"required": [
"isMaximized"
],
"additionalProperties": false
}
},
"maxButtonEvent": {
"data": {
"type": "object",
"properties": {
"event": {
"type": "string",
"enum": [
"enter",
"leave",
"down",
"up",
"click"
]
}
},
"required": [
"event"
],
"additionalProperties": false
}
},
"apiCredentialTestResult": {
"properties": {
"requestId": {
"type": "string"
},
"ok": {
"type": "boolean"
},
"message": {
"type": "string"
}
},
"required": [
"requestId",
"ok",
"message"
],
"additionalProperties": false
},
"defaultImeResponse": {
"properties": {
"requestId": {
"type": "string"
},
"action": {
"type": "string"
},
"ok": {
"type": "boolean"
},
"message": {
"type": "string"
},
"enabled": {
"type": "boolean"
},
"isDefault": {
"type": "boolean"
}
},
"required": [
"requestId",
"action",
"ok",
"message"
],
"additionalProperties": false
},
"gameCompatResponse": {
"properties": {
"requestId": {
"type": "string"
},
"action": {
"type": "string"
},
"ok": {
"type": "boolean"
},
"message": {
"type": "string"
},
"enabled": {
"type": "boolean"
},
"name": {
"type": "string"
},
"registeredName": {
"type": "string"
},
"defaultName": {
"type": "string"
}
},
"required": [
"requestId",
"action",
"ok",
"message"
],
"additionalProperties": false
},
"apiModelListResult": {
"properties": {
"requestId": {
"type": "string"
},
"ok": {
"type": "boolean"
},
"message": {
"type": "string"
},
"models": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"requestId",
"ok",
"message"
],
"additionalProperties": false
},
"dictionaryResponse": {
"properties": {
"requestId": {
"type": "string"
},
"action": {
"type": "string"
},
"dictionary": {
"type": "string"
},
"ok": {
"type": "boolean"
},
"message": {
"type": "string"
},
"rows": {
"type": "array",
"items": {
"type": "object",
"properties": {
"word": {
"type": "string"
},
"code": {
"type": "string"
},
"display": {
"type": "string"
},
"weight": {
"type": "integer"
}
},
"required": [
"word"
],
"additionalProperties": false
}
},
"content": {
"type": "string"
},
"filename": {
"type": "string"
},
"offset": {
"type": "integer",
"minimum": 0
},
"hasMore": {
"type": "boolean"
}
},
"required": [
"requestId",
"ok",
"message",
"rows"
],
"additionalProperties": true
},
"statsResponse": {
"properties": {
"requestId": {
"type": "string"
},
"action": {
"type": "string"
},
"ok": {
"type": "boolean"
},
"message": {
"type": "string"
},
"overview": {
"type": "object",
"properties": {
"hasData": {
"type": "boolean"
},
"firstDayKey": {
"type": "integer"
},
"lastDayKey": {
"type": "integer"
},
"days": {
"type": "integer"
},
"totalChars": {
"type": "integer"
},
"totalActiveMs": {
"type": "integer"
},
"todayDayKey": {
"type": "integer"
},
"todayChars": {
"type": "integer"
},
"todayActiveMs": {
"type": "integer"
},
"averagePerDay": {
"type": "number"
},
"currentStreak": {
"type": "integer"
},
"longestStreak": {
"type": "integer"
},
"bestDayKey": {
"type": "integer"
},
"bestDayChars": {
"type": "integer"
},
"todaySpeed": {
"type": "number"
},
"averageSpeed": {
"type": "number"
},
"fastestSpeed": {
"type": "number"
},
"fastestDayKey": {
"type": "integer"
},
"todayFirstWordRatio": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
]
},
"totalFirstWordRatio": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
]
},
"todayFirstWordTotal": {
"type": "integer"
},
"categories": {
"type": "object",
"properties": {
"cjk": {
"type": "integer"
},
"latin": {
"type": "integer"
},
"digit": {
"type": "integer"
},
"punct": {
"type": "integer"
},
"other": {
"type": "integer"
}
},
"required": [
"cjk",
"latin",
"digit",
"punct",
"other"
],
"additionalProperties": false
},
"todayHourly": {
"type": "array",
"items": {
"type": "integer"
}
},
"daily": {
"type": "array",
"items": {
"type": "object",
"properties": {
"dayKey": {
"type": "integer"
},
"cjk": {
"type": "integer"
},
"latin": {
"type": "integer"
},
"digit": {
"type": "integer"
},
"punct": {
"type": "integer"
},
"other": {
"type": "integer"
},
"activeMs": {
"type": "integer"
},
"firstWordHits": {
"type": "integer"
},
"firstWordTotal": {
"type": "integer"
}
},
"required": [
"dayKey",
"cjk",
"latin",
"digit",
"punct",
"other",
"activeMs",
"firstWordHits",
"firstWordTotal"
],
"additionalProperties": false
}
}
},
"required": [
"hasData",
"firstDayKey",
"lastDayKey",
"days",
"totalChars",
"totalActiveMs",
"todayDayKey",
"todayChars",
"todayActiveMs",
"averagePerDay",
"currentStreak",
"longestStreak",
"bestDayKey",
"bestDayChars",
"todaySpeed",
"averageSpeed",
"fastestSpeed",
"fastestDayKey",
"todayFirstWordRatio",
"totalFirstWordRatio",
"todayFirstWordTotal",
"categories",
"todayHourly",
"daily"
],
"additionalProperties": false
},
"removedDays": {
"type": "integer"
}
},
"required": [
"requestId",
"action",
"ok",
"message"
],
"additionalProperties": true
}
}
}