create long hash
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
import { sendUserToast } from '$lib/toast'
|
||||
import { openDB, type DBSchema as IDBSchema, type IDBPDatabase } from 'idb'
|
||||
import { isInitialCode } from '$lib/script_helpers'
|
||||
import { langToExt } from '$lib/editorUtils'
|
||||
import { createLongHash, langToExt } from '$lib/editorUtils'
|
||||
import { scriptLangToEditorLang } from '$lib/scripts'
|
||||
|
||||
export let lang: ScriptLang | 'bunnative'
|
||||
@@ -159,7 +159,7 @@
|
||||
}
|
||||
})
|
||||
|
||||
let currentChatId: string = crypto.randomUUID()
|
||||
let currentChatId: string = createLongHash()
|
||||
let savedChats: Record<
|
||||
string,
|
||||
{
|
||||
@@ -292,7 +292,7 @@
|
||||
|
||||
async function saveAndClear() {
|
||||
await saveChat()
|
||||
currentChatId = crypto.randomUUID()
|
||||
currentChatId = createLongHash()
|
||||
displayMessages = []
|
||||
messages = [prepareSystemMessage()]
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { createLongHash } from '$lib/editorUtils'
|
||||
import { type editor as meditor } from 'monaco-editor'
|
||||
|
||||
export type VisualChange =
|
||||
@@ -71,7 +72,7 @@ export function setGlobalCSS(id: string, cssCode: string) {
|
||||
}
|
||||
|
||||
function addInlineGhostText(change: Extract<VisualChange, { type: 'added_inline' }>) {
|
||||
const cssId = crypto.randomUUID()
|
||||
const cssId = createLongHash()
|
||||
const decoration = {
|
||||
range: {
|
||||
startLineNumber: change.position.line,
|
||||
|
||||
@@ -44,6 +44,10 @@ export function createHash() {
|
||||
return (Math.random() + 1).toString(36).substring(2)
|
||||
}
|
||||
|
||||
export function createLongHash() {
|
||||
return Math.random().toString(36).substring(2) + Math.random().toString(36).substring(2)
|
||||
}
|
||||
|
||||
export function langToExt(lang: string): string {
|
||||
switch (lang) {
|
||||
case 'javascript':
|
||||
|
||||
Reference in New Issue
Block a user