Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
7ef5aa52
Commit
7ef5aa52
authored
Aug 13, 2024
by
Timothy J. Baek
Browse files
chore: format
parent
70f580ec
Changes
24
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
88 additions
and
70 deletions
+88
-70
src/lib/utils/index.ts
src/lib/utils/index.ts
+2
-2
src/lib/utils/katex-extension.ts
src/lib/utils/katex-extension.ts
+65
-62
src/routes/(app)/workspace/models/edit/+page.svelte
src/routes/(app)/workspace/models/edit/+page.svelte
+3
-3
src/routes/auth/+page.svelte
src/routes/auth/+page.svelte
+18
-3
No files found.
src/lib/utils/index.ts
View file @
7ef5aa52
src/lib/utils/katex-extension.ts
View file @
7ef5aa52
import
katex
from
'
katex
'
;
const
inlineRule
=
/^
(\${1,2})(?!\$)((?:\\
.|
[^\\\n])
*
?(?:\\
.|
[^\\\n\$]))\1(?=[\s
?!
\.
,:?!。,:
]
|$
)
/
;
const
inlineRule
=
/^
(\${1,2})(?!\$)((?:\\
.|
[^\\\n])
*
?(?:\\
.|
[^\\\n\$]))\1(?=[\s
?!
\.
,:?!。,:
]
|$
)
/
;
const
inlineRuleNonStandard
=
/^
(\${1,2})(?!\$)((?:\\
.|
[^\\\n])
*
?(?:\\
.|
[^\\\n\$]))\1
/
;
// Non-standard, even if there are no spaces before and after $ or $$, try to parse
const
blockRule
=
/^
(\${1,2})\n((?:\\[^]
|
[^\\])
+
?)\n\1(?:\n
|$
)
/
;
export
default
function
(
options
=
{})
{
export
default
function
(
options
=
{})
{
return
{
extensions
:
[
inlineKatex
(
options
,
createRenderer
(
options
,
false
)),
blockKatex
(
options
,
createRenderer
(
options
,
true
))
,
],
blockKatex
(
options
,
createRenderer
(
options
,
true
))
]
};
}
function
createRenderer
(
options
,
newlineAfter
)
{
return
(
token
)
=>
katex
.
renderToString
(
token
.
text
,
{
...
options
,
displayMode
:
token
.
displayMode
})
+
(
newlineAfter
?
'
\n
'
:
''
);
return
(
token
)
=>
katex
.
renderToString
(
token
.
text
,
{
...
options
,
displayMode
:
token
.
displayMode
})
+
(
newlineAfter
?
'
\n
'
:
''
);
}
function
inlineKatex
(
options
,
renderer
)
{
...
...
@@ -52,11 +55,11 @@ function inlineKatex(options, renderer) {
type
:
'
inlineKatex
'
,
raw
:
match
[
0
],
text
:
match
[
2
].
trim
(),
displayMode
:
match
[
1
].
length
===
2
,
displayMode
:
match
[
1
].
length
===
2
};
}
},
renderer
,
renderer
};
}
...
...
@@ -71,10 +74,10 @@ function blockKatex(options, renderer) {
type
:
'
blockKatex
'
,
raw
:
match
[
0
],
text
:
match
[
2
].
trim
(),
displayMode
:
match
[
1
].
length
===
2
,
displayMode
:
match
[
1
].
length
===
2
};
}
},
renderer
,
renderer
};
}
src/routes/(app)/workspace/models/edit/+page.svelte
View file @
7ef5aa52
...
...
@@ -154,7 +154,7 @@
params
=
{
...
params
,
...
model
?.
info
?.
params
};
params
.
stop
=
params
?.
stop
?
(
typeof
params
.
stop
===
'string'
?
params
.
stop
.
split
(
','
)
:
params
?.
stop
??
[]).
join
(
?
(
typeof
params
.
stop
===
'string'
?
params
.
stop
.
split
(
','
)
:
(
params
?.
stop
??
[])
)
.
join
(
','
)
:
null
;
...
...
src/routes/auth/+page.svelte
View file @
7ef5aa52
...
...
@@ -352,8 +352,23 @@
<style>
.font-mona {
font-family: 'Mona Sans', -apple-system, 'Inter', ui-sans-serif, system-ui, 'Segoe UI', Roboto,
Ubuntu, Cantarell, 'Noto Sans', sans-serif, 'Helvetica Neue', Arial, 'Apple Color Emoji',
'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
font-family:
'Mona Sans',
-apple-system,
'Inter',
ui-sans-serif,
system-ui,
'Segoe UI',
Roboto,
Ubuntu,
Cantarell,
'Noto Sans',
sans-serif,
'Helvetica Neue',
Arial,
'Apple Color Emoji',
'Segoe UI Emoji',
'Segoe UI Symbol',
'Noto Color Emoji';
}
</style>
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment