Refactor settings store to rename proModel to proThinking and update related logic; enhance CSS for energy efficiency and reduced motion preferences; improve i18n translations for better clarity and consistency; modify proBlock utility functions for clearer instruction handling; streamline Vite configuration by removing unnecessary Univer.js dependencies.
This commit is contained in:
@@ -40,6 +40,7 @@ import { editorViewCtx } from '@milkdown/kit/core'
|
||||
import { copilotPlugin, copilotConfigCtx, copilotGhostMark, setCopilotEnabled, clearGhostSuggestion } from '../plugins/copilotPlugin'
|
||||
import { hiddenTextInputPlugin, hiddenTextNode, hiddenTextRemark, hiddenTextView } from '../plugins/hiddenTextPlugin'
|
||||
import { fetchSuggestion } from '../utils/api.js'
|
||||
import { isDocumentVisible, getRecommendedDebounce, getRecommendedSyncInterval } from '../composables/useVisibility.js'
|
||||
|
||||
const props = defineProps({
|
||||
docType: { type: String, default: 'txt' },
|
||||
@@ -81,13 +82,16 @@ const toggleCollapse = () => {
|
||||
|
||||
const syncContent = () => {
|
||||
if (!crepe) return
|
||||
// Skip content sync when tab is hidden (energy saving for nested editors)
|
||||
if (!isDocumentVisible()) return
|
||||
if (syncTimer) clearTimeout(syncTimer)
|
||||
const syncInterval = getRecommendedSyncInterval(120)
|
||||
syncTimer = setTimeout(async () => {
|
||||
if (!crepe || syncingExternal) return
|
||||
const markdown = await crepe.getMarkdown()
|
||||
currentContent.value = markdown
|
||||
props.onUpdateContent?.(markdown)
|
||||
}, 120)
|
||||
}, syncInterval)
|
||||
}
|
||||
|
||||
const syncExternalContent = async (nextValue) => {
|
||||
@@ -139,7 +143,7 @@ onMounted(async () => {
|
||||
if (payload?.blocked) return ''
|
||||
return fetchSuggestion(payload?.prefix ?? prefix, payload?.suffix ?? suffix, payload?.languageId ?? languageId, signal)
|
||||
},
|
||||
debounceMs: 900,
|
||||
debounceMs: getRecommendedDebounce(900),
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user