release: ship v1.5.0 with on-device writing suggestions
Adds next-sentence suggestions while typing, weekly input insights and a personal phrase memory to the desktop app, and fixes custom instructions so they process the text instead of inserting the instruction's own wording. Local model requests are now bounded and individually cancellable. Bumps the product version to 1.5.0 (Android/iOS build 1050000), refreshes the landing and web download links, and records the new INPUT feature rows and the open verification gaps in the infrastructure map.
This commit is contained in:
parent
99f06c253c
commit
5c11ee2fde
104 changed files with 14410 additions and 174 deletions
200
apps/desktop/src/renderer/popups/suggestion-overlay/script.js
Normal file
200
apps/desktop/src/renderer/popups/suggestion-overlay/script.js
Normal file
|
|
@ -0,0 +1,200 @@
|
|||
// Suggestion Overlay 팝업 스크립트
|
||||
// 입력 인텔리전스: 다음 문장 제안(ghost text)을 커서 옆에 보여준다.
|
||||
//
|
||||
// 상태 세 가지를 화면에 드러낸다:
|
||||
// warmingUp - 모델을 메모리에 올리는 중 (스피너 + "준비 중")
|
||||
// generating - 토큰이 만들어지는 중 (스피너 + 도착한 부분 텍스트)
|
||||
// 후보 도착 - 최대 5개, 목록은 스크롤 가능
|
||||
//
|
||||
// 이 창은 focusable:false 다. 그래서 키 입력(수락/순환/닫기)은 전역 키바인딩이
|
||||
// 메인에서 처리하고, 이 파일은 마우스 클릭만 처리한다.
|
||||
|
||||
;(function () {
|
||||
'use strict'
|
||||
|
||||
var candidatesContainer = document.getElementById('candidates')
|
||||
var provenanceContainer = document.getElementById('provenance')
|
||||
var hintsContainer = document.getElementById('hints')
|
||||
var statusRow = document.getElementById('status')
|
||||
var statusText = document.getElementById('statusText')
|
||||
var panel = document.getElementById('panel')
|
||||
var closeButton = document.getElementById('close')
|
||||
|
||||
/** @type {string[]} */
|
||||
var candidates = []
|
||||
var activeIndex = 0
|
||||
var generating = false
|
||||
var warmingUp = false
|
||||
var partialText = null
|
||||
var provenance = null
|
||||
var i18nStrings = {}
|
||||
var generatingSince = 0
|
||||
var tickTimer = null
|
||||
|
||||
function render() {
|
||||
candidatesContainer.textContent = ''
|
||||
|
||||
var busy = warmingUp || generating
|
||||
if (statusRow) statusRow.hidden = !busy
|
||||
if (statusText) {
|
||||
if (warmingUp) {
|
||||
statusText.textContent = i18nStrings.suggestionWarming || '...'
|
||||
} else if (generating) {
|
||||
// 경과 시간을 보여준다 — 모델이 바쁘면 몇 초 걸리는지 보이는 편이 덜 답답하다.
|
||||
var seconds = generatingSince
|
||||
? Math.max(1, Math.round((Date.now() - generatingSince) / 1000))
|
||||
: 1
|
||||
var template = i18nStrings.suggestionGenerating || i18nStrings.suggestionLoading || '...'
|
||||
statusText.textContent = template.replace('{{seconds}}', String(seconds))
|
||||
} else {
|
||||
statusText.textContent = ''
|
||||
}
|
||||
}
|
||||
|
||||
if (candidates.length === 0) {
|
||||
// 스트리밍 중이면 도착한 부분 텍스트를 그대로 보여준다 ("계속 생성되는" 느낌).
|
||||
if (partialText) {
|
||||
var streaming = document.createElement('div')
|
||||
streaming.className = 'suggestion-item streaming'
|
||||
streaming.textContent = partialText
|
||||
candidatesContainer.appendChild(streaming)
|
||||
}
|
||||
renderHints()
|
||||
renderProvenance()
|
||||
return
|
||||
}
|
||||
|
||||
for (var i = 0; i < candidates.length; i++) {
|
||||
var item = document.createElement('button')
|
||||
item.type = 'button'
|
||||
item.className = i === activeIndex ? 'suggestion-item active' : 'suggestion-item'
|
||||
item.setAttribute('data-index', String(i))
|
||||
item.textContent = candidates[i]
|
||||
item.addEventListener('click', onItemClick)
|
||||
candidatesContainer.appendChild(item)
|
||||
}
|
||||
|
||||
renderHints()
|
||||
renderProvenance()
|
||||
}
|
||||
|
||||
function renderProvenance() {
|
||||
if (!provenanceContainer) return
|
||||
provenanceContainer.textContent = ''
|
||||
if (!provenance) return
|
||||
|
||||
var parts = []
|
||||
var sourceLabel = provenance.mode === 'local-memory'
|
||||
? i18nStrings.suggestionSourceMemory
|
||||
: i18nStrings.suggestionSourceModel
|
||||
if (sourceLabel) parts.push(sourceLabel)
|
||||
var counts = [
|
||||
['continuationCount', 'suggestionContinuations'],
|
||||
['relatedCount', 'suggestionRelated'],
|
||||
['phraseCount', 'suggestionPhrases'],
|
||||
['appPhraseCount', 'suggestionAppPhrases']
|
||||
]
|
||||
for (var i = 0; i < counts.length; i++) {
|
||||
var count = provenance[counts[i][0]] || 0
|
||||
var countLabel = i18nStrings[counts[i][1]]
|
||||
if (count > 0 && countLabel) parts.push(countLabel + ' ' + count)
|
||||
}
|
||||
provenanceContainer.textContent = parts.join(' · ')
|
||||
}
|
||||
|
||||
function renderHints() {
|
||||
hintsContainer.textContent = ''
|
||||
if (candidates.length <= 1 && !generating) return
|
||||
|
||||
var hint = document.createElement('span')
|
||||
hint.className = 'hint'
|
||||
if (candidates.length > 0) {
|
||||
var nextLabel = i18nStrings.suggestionHintNext || 'Next'
|
||||
hint.textContent = nextLabel + ' ' + (activeIndex + 1) + '/' + candidates.length
|
||||
} else {
|
||||
hint.textContent = i18nStrings.suggestionHintGenerating || '…'
|
||||
}
|
||||
hintsContainer.appendChild(hint)
|
||||
}
|
||||
|
||||
function onItemClick(event) {
|
||||
var target = event.currentTarget
|
||||
var index = Number(target.getAttribute('data-index'))
|
||||
if (!window.popupAPI) return
|
||||
window.popupAPI.send('suggestionPopup:accept', index)
|
||||
}
|
||||
|
||||
function applyPayload(payload) {
|
||||
if (!payload) return
|
||||
if (payload._i18n) i18nStrings = payload._i18n
|
||||
candidates = (payload.candidates || []).map(function (candidate) {
|
||||
return candidate && candidate.text ? candidate.text : String(candidate)
|
||||
})
|
||||
activeIndex = payload.activeIndex || 0
|
||||
if (payload.generating !== undefined) generating = payload.generating === true
|
||||
if (payload.warmingUp !== undefined) warmingUp = payload.warmingUp === true
|
||||
if (payload.partialText !== undefined) partialText = payload.partialText || null
|
||||
if (payload.provenance !== undefined) provenance = payload.provenance || null
|
||||
}
|
||||
|
||||
function startTick() {
|
||||
if (tickTimer) return
|
||||
tickTimer = setInterval(function () {
|
||||
if (!generating && !warmingUp) {
|
||||
clearInterval(tickTimer)
|
||||
tickTimer = null
|
||||
generatingSince = 0
|
||||
return
|
||||
}
|
||||
render()
|
||||
}, 500)
|
||||
}
|
||||
|
||||
function handleShow(payload) {
|
||||
applyPayload(payload)
|
||||
if (payload && payload.generating) generatingSince = Date.now()
|
||||
startTick()
|
||||
if (panel) panel.classList.add('visible')
|
||||
render()
|
||||
}
|
||||
|
||||
function handleUpdate(payload) {
|
||||
var wasGenerating = generating
|
||||
applyPayload(payload)
|
||||
if (generating && !wasGenerating) generatingSince = Date.now()
|
||||
startTick()
|
||||
render()
|
||||
}
|
||||
|
||||
function handleHide() {
|
||||
if (panel) panel.classList.remove('visible')
|
||||
if (tickTimer) {
|
||||
clearInterval(tickTimer)
|
||||
tickTimer = null
|
||||
}
|
||||
generatingSince = 0
|
||||
generating = false
|
||||
warmingUp = false
|
||||
partialText = null
|
||||
provenance = null
|
||||
candidates = []
|
||||
activeIndex = 0
|
||||
candidatesContainer.textContent = ''
|
||||
if (provenanceContainer) provenanceContainer.textContent = ''
|
||||
hintsContainer.textContent = ''
|
||||
}
|
||||
|
||||
if (closeButton) {
|
||||
// 마우스로도 닫을 수 있어야 한다 (키보드만 있으면 불편하다는 피드백).
|
||||
closeButton.addEventListener('click', function () {
|
||||
handleHide()
|
||||
if (window.popupAPI) window.popupAPI.send('suggestionPopup:dismiss')
|
||||
})
|
||||
}
|
||||
|
||||
if (window.popupAPI) {
|
||||
window.popupAPI.on('suggestionPopup:show', handleShow)
|
||||
window.popupAPI.on('suggestionPopup:update', handleUpdate)
|
||||
window.popupAPI.on('suggestionPopup:hide', handleHide)
|
||||
}
|
||||
})()
|
||||
Loading…
Add table
Add a link
Reference in a new issue