1
0
Fork 0

Fix huggingface tokenizer config

This commit is contained in:
Pabloader 2026-02-17 13:31:30 +00:00
parent 22eeae962a
commit ce67d07269
6 changed files with 29 additions and 22 deletions

View File

@ -88,6 +88,7 @@ body {
display: flex;
flex-direction: row;
justify-content: center;
background-color: var(--backgroundColor);
}
.app {

View File

@ -2,11 +2,9 @@ import { Header } from "./header/header";
import { Chat } from "./chat";
import { Input } from "./input";
import bgImage from '../assets/bg.jpg';
export const App = () => {
return (
<div class='root' style={{ backgroundImage: `url('${bgImage.src}')` }}>
<div class='root'>
<div class='app'>
<Header />
<Chat />

View File

@ -35,7 +35,12 @@ export const ConnectionEditor = ({ connection, setConnection }: IProps) => {
Connection.getContextLength(connection).then(setContextLength);
} else if (connection.type === 'horde') {
Connection.getHordeModels()
.then(m => setHordeModels(Array.from(m.values()).sort((a, b) => a.name.localeCompare(b.name))));
.then(m => setHordeModels(Array.from(
m.values())
.sort((a, b) =>
b.maxContext - a.maxContext || a.name.localeCompare(b.name)
)
));
}
}, [connection]);

View File

@ -66,26 +66,26 @@
flex-wrap: wrap;
}
.lore {
.modal {
display: flex;
flex-direction: column;
gap: 10px;
min-height: 80dvh;
}
.currentStory {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
gap: 10px;
.currentStory {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
gap: 10px;
.storiesSelector {
height: 24px;
flex-grow: 1;
}
}
.loreText {
.storiesSelector {
height: 24px;
flex-grow: 1;
}
}
.loreText {
flex-grow: 1;
}

View File

@ -130,7 +130,7 @@ export const Header = () => {
<h3 class={styles.modalTitle}>Connection settings</h3>
<ConnectionEditor connection={connection} setConnection={setConnection} />
</Modal>
<Modal open={loreOpen.value} onClose={loreOpen.setFalse} class={styles.lore}>
<Modal open={loreOpen.value} onClose={loreOpen.setFalse} class={styles.modal}>
<h3 class={styles.modalTitle}>Lore Editor</h3>
<div class={styles.currentStory}>
<select value={currentStory} onChange={handleChangeStory} class={styles.storiesSelector}>
@ -152,7 +152,7 @@ export const Header = () => {
class={styles.loreText}
/>
</Modal>
<Modal open={genparamsOpen.value} onClose={genparamsOpen.setFalse}>
<Modal open={genparamsOpen.value} onClose={genparamsOpen.setFalse} class={styles.modal}>
<h3 class={styles.modalTitle}>Generation Parameters</h3>
<div className={styles.scrollPane}>
<h4 class={styles.modalTitle}>Banned phrases</h4>

View File

@ -104,9 +104,12 @@ export namespace Huggingface {
try {
console.log(`[huggingface] searching config in '${name}/tokenizer_config.json'`);
const fileResponse = await hub.downloadFile({ repo: name, path: 'tokenizer_config.json' });
const fileResponse = await hub.downloadFile({
repo: name,
path: 'tokenizer_config.json',
});
if (fileResponse) {
const maybeConfig = await fileResponse.json();
const maybeConfig = JSON.parse(await fileResponse.text());
if (isTokenizerConfig(maybeConfig)) {
tokenizerConfig = maybeConfig;
foundName = `${name}/tokenizer_config.json`;