lint
This commit is contained in:
parent
5d7b51ba1d
commit
17d5ee196f
|
@ -62,7 +62,7 @@
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
import { exportChatAsJSON, exportProfileAsJSON } from './Export.svelte'
|
import { exportChatAsJSON, exportProfileAsJSON } from './Export.svelte'
|
||||||
import { clickOutside } from 'svelte-use-click-outside'
|
import { clickOutside } from 'svelte-use-click-outside'
|
||||||
import { getPrice } from './Stats.svelte';
|
import { getPrice } from './Stats.svelte'
|
||||||
|
|
||||||
// This makes it possible to override the OpenAI API base URL in the .env file
|
// This makes it possible to override the OpenAI API base URL in the .env file
|
||||||
const apiBase = import.meta.env.VITE_API_BASE || 'https://api.openai.com'
|
const apiBase = import.meta.env.VITE_API_BASE || 'https://api.openai.com'
|
||||||
|
@ -94,7 +94,6 @@
|
||||||
updateChatSettings(chatId)
|
updateChatSettings(chatId)
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
|
|
||||||
// Focus the input on mount
|
// Focus the input on mount
|
||||||
focusInput()
|
focusInput()
|
||||||
|
|
||||||
|
|
|
@ -175,12 +175,6 @@
|
||||||
min-width: 100px;
|
min-width: 100px;
|
||||||
min-height: 30px;
|
min-height: 30px;
|
||||||
}
|
}
|
||||||
a.message-display {
|
|
||||||
display: block;
|
|
||||||
text-decoration: none !important;
|
|
||||||
min-width: 100px;
|
|
||||||
min-height: 30px;
|
|
||||||
}
|
|
||||||
.button-pack {
|
.button-pack {
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
name: `Chat ${chatId}`,
|
name: `Chat ${chatId}`,
|
||||||
settings: {} as ChatSettings,
|
settings: {} as ChatSettings,
|
||||||
messages: [],
|
messages: [],
|
||||||
usage:{} as Record<Model,Usage>,
|
usage: {} as Record<Model, Usage>
|
||||||
})
|
})
|
||||||
chatsStorage.set(chats)
|
chatsStorage.set(chats)
|
||||||
// Apply defaults and prepare it to start
|
// Apply defaults and prepare it to start
|
||||||
|
@ -83,9 +83,9 @@
|
||||||
})
|
})
|
||||||
// Make sure the usage totals object is set
|
// Make sure the usage totals object is set
|
||||||
// (some earlier versions of this had different structures)
|
// (some earlier versions of this had different structures)
|
||||||
const hasUsage = chat.usage && !Array.isArray(chat.usage)
|
const hasUsage = chat.usage && !Array.isArray(chat.usage) &&
|
||||||
&& typeof chat.usage === 'object'
|
typeof chat.usage === 'object' &&
|
||||||
&& Object.values(chat.usage).find(v=>'prompt_tokens' in v)
|
Object.values(chat.usage).find(v => 'prompt_tokens' in v)
|
||||||
if (!hasUsage) {
|
if (!hasUsage) {
|
||||||
const usageMap:Record<Model, Usage> = {}
|
const usageMap:Record<Model, Usage> = {}
|
||||||
chat.usage = usageMap
|
chat.usage = usageMap
|
||||||
|
@ -138,7 +138,7 @@
|
||||||
total = {
|
total = {
|
||||||
prompt_tokens: 0,
|
prompt_tokens: 0,
|
||||||
completion_tokens: 0,
|
completion_tokens: 0,
|
||||||
total_tokens: 0,
|
total_tokens: 0
|
||||||
}
|
}
|
||||||
chat.usage[model] = total
|
chat.usage[model] = total
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue