Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/renderer/src/components/markdown/MarkdownRenderer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
:codeBlockDarkTheme="codeBlockDarkTheme"
:codeBlockLightTheme="codeBlockLightTheme"
:codeBlockMonacoOptions="codeBlockMonacoOption"
:final="!props.loading"
:typewriter="!!props.loading"
:codeBlockStream="!!props.loading"
@copy="$emit('copy', $event)"
/>
</div>
Expand Down Expand Up @@ -38,7 +35,6 @@ import type { MarkdownLinkContext } from './linkTypes'
const props = defineProps<{
content: string
debug?: boolean
loading?: boolean
messageId?: string
threadId?: string
linkContext?: MarkdownLinkContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<MarkdownRenderer
v-if="part.type === 'text'"
:content="part.content"
:loading="props.block.status === 'loading'"
:loading="part.loading"
:message-id="messageId"
:thread-id="threadId"
:link-context="{
Expand Down
3 changes: 0 additions & 3 deletions src/renderer/src/components/think-content/ThinkContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@
:maxLiveNodes="120"
:liveNodeBuffer="30"
:customId="customId"
:final="!props.thinking"
:typewriter="props.thinking"
:codeBlockStream="props.thinking"
/>
</div>

Expand Down
84 changes: 0 additions & 84 deletions src/renderer/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ import 'katex/dist/katex.min.css'
import {
clearKaTeXWorker,
clearMermaidWorker,
enableKatex,
enableMermaid,
preloadCodeBlockRuntime,
setKaTeXWorker,
setMermaidWorker,
terminateWorker
Expand All @@ -37,9 +34,6 @@ if (!globalScope.__markdownWorkers) {
setMermaidWorker(mermaid)
}

enableKatex()
enableMermaid(() => import('mermaid'))

window.addEventListener('beforeunload', () => {
const workers = globalScope.__markdownWorkers
if (workers) {
Expand All @@ -52,82 +46,6 @@ window.addEventListener('beforeunload', () => {
terminateWorker()
})

const codeBlockThemes = ['vitesse-dark', 'vitesse-light']
const codeBlockLanguages = [
'jsx',
'tsx',
'vue',
'csharp',
'python',
'java',
'c',
'cpp',
'rust',
'go',
'shell',
'shellscript',
'powershell',
'sql',
'json',
'html',
'javascript',
'typescript',
'css',
'markdown',
'xml',
'yaml',
'toml',
'dockerfile',
'kotlin',
'objective-c',
'objective-cpp',
'php',
'ruby',
'scala',
'svelte',
'swift',
'erlang',
'angular-html',
'angular-ts',
'dart',
'lua',
'mermaid',
'cmake',
'nginx',
'plaintext'
]

const preloadCodeBlockRuntimeAsync = async () => {
try {
const { registerMonacoThemes } = await import('stream-monaco')

await Promise.all([
preloadCodeBlockRuntime(),
registerMonacoThemes(codeBlockThemes, codeBlockLanguages)
])
} catch (error) {
console.error('[deepchat] failed to preload code block runtime', error)
}
}

const scheduleCodeBlockRuntimePreload = () => {
const requestIdleCallback = window.requestIdleCallback

if (typeof requestIdleCallback === 'function') {
requestIdleCallback(
() => {
void preloadCodeBlockRuntimeAsync()
},
{ timeout: 1500 }
)
return
}

window.setTimeout(() => {
void preloadCodeBlockRuntimeAsync()
}, 0)
}

const i18n = createI18n({
locale: 'zh-CN',
fallbackLocale: 'en-US',
Expand Down Expand Up @@ -158,5 +76,3 @@ setTimeout(() => {
console.error('Failed to preload icons:', error)
})
}, 0)

scheduleCodeBlockRuntimePreload()