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
e31cf081
"backend/vscode:/vscode.git/clone" did not exist on "bdd153d8f5d91487f8c7eca77c340c62b1073626"
Commit
e31cf081
authored
May 06, 2024
by
Jannik Streidl
Browse files
merged conflicts in PL locale
parents
e57c0c30
e92311b4
Changes
47
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
77 additions
and
44 deletions
+77
-44
src/lib/i18n/locales/zh-CN/translation.json
src/lib/i18n/locales/zh-CN/translation.json
+4
-0
src/lib/i18n/locales/zh-TW/translation.json
src/lib/i18n/locales/zh-TW/translation.json
+4
-0
src/lib/utils/index.ts
src/lib/utils/index.ts
+39
-17
src/routes/(app)/+layout.svelte
src/routes/(app)/+layout.svelte
+3
-3
src/routes/(app)/playground/+page.svelte
src/routes/(app)/playground/+page.svelte
+1
-1
src/routes/auth/+page.svelte
src/routes/auth/+page.svelte
+25
-22
src/routes/s/[id]/+page.svelte
src/routes/s/[id]/+page.svelte
+1
-1
No files found.
src/lib/i18n/locales/zh-CN/translation.json
View file @
e31cf081
...
...
@@ -15,6 +15,7 @@
"Add a short description about what this modelfile does"
:
"为这个模型文件添加一段简短的描述"
,
"Add a short title for this prompt"
:
"为这个提示词添加一个简短的标题"
,
"Add a tag"
:
"添加标签"
,
"Add custom prompt"
:
""
,
"Add Docs"
:
"添加文档"
,
"Add Files"
:
"添加文件"
,
"Add message"
:
"添加消息"
,
...
...
@@ -44,6 +45,7 @@
"Archived Chats"
:
"聊天记录存档"
,
"are allowed - Activate this command by typing"
:
"允许 - 通过输入来激活这个命令"
,
"Are you sure?"
:
"你确定吗?"
,
"Attach file"
:
""
,
"Attention to detail"
:
""
,
"Audio"
:
"音频"
,
"Auto-playback response"
:
"自动播放回应"
,
...
...
@@ -214,6 +216,7 @@
"Import Modelfiles"
:
"导入模型文件"
,
"Import Prompts"
:
"导入提示"
,
"Include `--api` flag when running stable-diffusion-webui"
:
"运行stable-diffusion-webui时包含`--api`标志"
,
"Input commands"
:
""
,
"Interface"
:
"界面"
,
"join our Discord for help."
:
"加入我们的Discord寻求帮助。"
,
"JSON"
:
"JSON"
,
...
...
@@ -351,6 +354,7 @@
"Select a mode"
:
"选择一个模式"
,
"Select a model"
:
"选择一个模型"
,
"Select an Ollama instance"
:
"选择一个Ollama实例"
,
"Select model"
:
""
,
"Send a Message"
:
"发送消息"
,
"Send message"
:
"发送消息"
,
"Server connection verified"
:
"已验证服务器连接"
,
...
...
src/lib/i18n/locales/zh-TW/translation.json
View file @
e31cf081
...
...
@@ -15,6 +15,7 @@
"Add a short description about what this modelfile does"
:
"為這個 Modelfile 添加一段簡短的描述"
,
"Add a short title for this prompt"
:
"為這個提示詞添加一個簡短的標題"
,
"Add a tag"
:
"新增標籤"
,
"Add custom prompt"
:
""
,
"Add Docs"
:
"新增文件"
,
"Add Files"
:
"新增檔案"
,
"Add message"
:
"新增訊息"
,
...
...
@@ -44,6 +45,7 @@
"Archived Chats"
:
"聊天記錄存檔"
,
"are allowed - Activate this command by typing"
:
"是允許的 - 透過輸入"
,
"Are you sure?"
:
"你確定嗎?"
,
"Attach file"
:
""
,
"Attention to detail"
:
""
,
"Audio"
:
"音訊"
,
"Auto-playback response"
:
"自動播放回答"
,
...
...
@@ -214,6 +216,7 @@
"Import Modelfiles"
:
"匯入 Modelfiles"
,
"Import Prompts"
:
"匯入提示詞"
,
"Include `--api` flag when running stable-diffusion-webui"
:
"在運行 stable-diffusion-webui 時加上 `--api` 標誌"
,
"Input commands"
:
""
,
"Interface"
:
"介面"
,
"join our Discord for help."
:
"加入我們的 Discord 尋找幫助。"
,
"JSON"
:
"JSON"
,
...
...
@@ -351,6 +354,7 @@
"Select a mode"
:
"選擇模式"
,
"Select a model"
:
"選擇一個模型"
,
"Select an Ollama instance"
:
"選擇 Ollama 實例"
,
"Select model"
:
""
,
"Send a Message"
:
"傳送訊息"
,
"Send message"
:
"傳送訊息"
,
"Server connection verified"
:
"已驗證伺服器連線"
,
...
...
src/lib/utils/index.ts
View file @
e31cf081
...
...
@@ -472,29 +472,20 @@ export const blobToFile = (blob, fileName) => {
return
file
;
};
// promptTemplate replaces any occurrences of the following in the template with the prompt
// {{prompt}} will be replaced with the prompt
// {{prompt:start:<length>}} will be replaced with the first <length> characters of the prompt
// {{prompt:end:<length>}} will be replaced with the last <length> characters of the prompt
// Character length is used as we don't have the ability to tokenize the prompt
export
const
promptTemplate
=
(
template
:
string
,
prompt
:
string
)
=>
{
prompt
=
prompt
.
replace
(
/{{prompt}}|{{prompt:start:
\d
+}}|{{prompt:end:
\d
+}}/g
,
''
);
template
=
template
.
replace
(
/{{prompt}}/g
,
prompt
);
// Replace all instances of {{prompt:start:<length>}} with the first <length> characters of the prompt
const
startRegex
=
/{{prompt:start:
(\d
+
)
}}/g
;
let
startMatch
:
RegExpMatchArray
|
null
;
while
((
startMatch
=
startRegex
.
exec
(
template
))
!==
null
)
{
const
length
=
parseInt
(
startMatch
[
1
]);
template
=
template
.
replace
(
startMatch
[
0
],
prompt
.
substring
(
0
,
length
));
}
template
=
template
.
replace
(
/{{prompt:start:
(\d
+
)
}}/g
,
(
match
,
length
)
=>
prompt
.
substring
(
0
,
parseInt
(
length
))
);
// Replace all instances of {{prompt:end:<length>}} with the last <length> characters of the prompt
const
endRegex
=
/{{prompt:end:
(\d
+
)
}}/g
;
let
endMatch
:
RegExpMatchArray
|
null
;
while
((
endMatch
=
endRegex
.
exec
(
template
))
!==
null
)
{
const
length
=
parseInt
(
endMatch
[
1
]);
template
=
template
.
replace
(
endMatch
[
0
],
prompt
.
substring
(
prompt
.
length
-
length
));
}
template
=
template
.
replace
(
/{{prompt:end:
(\d
+
)
}}/g
,
(
match
,
length
)
=>
prompt
.
slice
(
-
parseInt
(
length
))
);
return
template
;
};
...
...
@@ -520,3 +511,34 @@ export const approximateToHumanReadable = (nanoseconds: number) => {
return
results
.
reverse
().
join
(
'
'
);
};
export
const
getTimeRange
=
(
timestamp
)
=>
{
const
now
=
new
Date
();
const
date
=
new
Date
(
timestamp
*
1000
);
// Convert Unix timestamp to milliseconds
// Calculate the difference in milliseconds
const
diffTime
=
now
.
getTime
()
-
date
.
getTime
();
const
diffDays
=
diffTime
/
(
1000
*
3600
*
24
);
const
nowDate
=
now
.
getDate
();
const
nowMonth
=
now
.
getMonth
();
const
nowYear
=
now
.
getFullYear
();
const
dateDate
=
date
.
getDate
();
const
dateMonth
=
date
.
getMonth
();
const
dateYear
=
date
.
getFullYear
();
if
(
nowYear
===
dateYear
&&
nowMonth
===
dateMonth
&&
nowDate
===
dateDate
)
{
return
'
Today
'
;
}
else
if
(
nowYear
===
dateYear
&&
nowMonth
===
dateMonth
&&
nowDate
-
dateDate
===
1
)
{
return
'
Yesterday
'
;
}
else
if
(
diffDays
<=
7
)
{
return
'
Previous 7 days
'
;
}
else
if
(
diffDays
<=
30
)
{
return
'
Previous 30 days
'
;
}
else
if
(
nowYear
===
dateYear
)
{
return
date
.
toLocaleString
(
'
default
'
,
{
month
:
'
long
'
});
}
else
{
return
date
.
getFullYear
().
toString
();
}
};
src/routes/(app)/+layout.svelte
View file @
e31cf081
...
...
@@ -201,11 +201,11 @@
>
{#if loaded}
{#if !['user', 'admin'].includes($user.role)}
<div class="fixed w-full h-full flex z-
50
">
<div class="fixed w-full h-full flex z-
[999]
">
<div
class="absolute w-full h-full backdrop-blur-
md
bg-white/
2
0 dark:bg-gray-900/50 flex justify-center"
class="absolute w-full h-full backdrop-blur-
lg
bg-white/
1
0 dark:bg-gray-900/50 flex justify-center"
>
<div class="m-auto pb-
44
flex flex-col justify-center">
<div class="m-auto pb-
10
flex flex-col justify-center">
<div class="max-w-md">
<div class="text-center dark:text-white text-2xl font-medium z-50">
Account Activation Pending<br /> Contact Admin for WebUI Access
...
...
src/routes/(app)/playground/+page.svelte
View file @
e31cf081
...
...
@@ -330,7 +330,7 @@
info: model
}))}
bind:value={selectedModelId}
className="
max-w-2xl
"
className="
w-[42rem]
"
/>
</div>
</div>
...
...
src/routes/auth/+page.svelte
View file @
e31cf081
...
...
@@ -81,7 +81,7 @@
</div>
</div>
<div class=" bg-white dark:bg-gray-9
0
0 min-h-screen w-full flex justify-center font-mona">
<div class=" bg-white dark:bg-gray-9
5
0 min-h-screen w-full flex justify-center font-mona">
<!-- <div class="hidden lg:flex lg:flex-1 px-10 md:px-16 w-full bg-yellow-50 justify-center">
<div class=" my-auto pb-16 text-left">
<div>
...
...
@@ -96,7 +96,7 @@
</div>
</div> -->
<div class="w-full sm:max-w-
lg
px-
4
min-h-screen flex flex-col">
<div class="w-full sm:max-w-
md
px-
10
min-h-screen flex flex-col
text-center
">
{#if $config?.trusted_header_auth ?? false}
<div class=" my-auto pb-10 w-full">
<div
...
...
@@ -114,27 +114,29 @@
</div>
</div>
{:else}
<div class=" my-auto pb-10 w-full">
<div class="
my-auto pb-10 w-full
dark:text-gray-100
">
<form
class=" flex flex-col justify-center
bg-white py-6 sm:py-16 px-6 sm:px-16 rounded-2xl
"
class=" flex flex-col justify-center"
on:submit|preventDefault={() => {
submitHandler();
}}
>
<div class=" text-xl sm:text-2xl font-bold">
{mode === 'signin' ? $i18n.t('Sign in') : $i18n.t('Sign up')}
{$i18n.t('to')}
{$WEBUI_NAME}
</div>
{#if mode === 'signup'}
<div class=" mt-1 text-xs font-medium text-gray-500">
ⓘ {$WEBUI_NAME}
{$i18n.t(
'does not make any external connections, and your data stays securely on your locally hosted server.'
)}
<div class="mb-1">
<div class=" text-2xl font-bold">
{mode === 'signin' ? $i18n.t('Sign in') : $i18n.t('Sign up')}
{$i18n.t('to')}
{$WEBUI_NAME}
</div>
{/if}
{#if mode === 'signup'}
<div class=" mt-1 text-xs font-medium text-gray-500">
ⓘ {$WEBUI_NAME}
{$i18n.t(
'does not make any external connections, and your data stays securely on your locally hosted server.'
)}
</div>
{/if}
</div>
<div class="flex flex-col mt-4">
{#if mode === 'signup'}
...
...
@@ -143,14 +145,14 @@
<input
bind:value={name}
type="text"
class="
border
px-
4
py-
2.5
rounded-2xl w-full text-sm"
class=" px-
5
py-
3
rounded-2xl w-full text-sm
outline-none border dark:border-none dark:bg-gray-900
"
autocomplete="name"
placeholder={$i18n.t('Enter Your Full Name')}
required
/>
</div>
<hr class=" my-3" />
<hr class=" my-3
dark:border-gray-900
" />
{/if}
<div class="mb-2">
...
...
@@ -158,7 +160,7 @@
<input
bind:value={email}
type="email"
class="
border
px-
4
py-
2.5
rounded-2xl w-full text-sm"
class=" px-
5
py-
3
rounded-2xl w-full text-sm
outline-none border dark:border-none dark:bg-gray-900
"
autocomplete="email"
placeholder={$i18n.t('Enter Your Email')}
required
...
...
@@ -167,10 +169,11 @@
<div>
<div class=" text-sm font-semibold text-left mb-1">{$i18n.t('Password')}</div>
<input
bind:value={password}
type="password"
class="
border
px-
4
py-
2.5
rounded-2xl w-full text-sm"
class=" px-
5
py-
3
rounded-2xl w-full text-sm
outline-none border dark:border-none dark:bg-gray-900
"
placeholder={$i18n.t('Enter Your Password')}
autocomplete="current-password"
required
...
...
@@ -180,7 +183,7 @@
<div class="mt-5">
<button
class=" bg-gray-900 hover:bg-gray-800 w-full rounded-
ful
l text-white font-semibold text-sm py-3 transition"
class=" bg-gray-900 hover:bg-gray-800 w-full rounded-
2x
l text-white font-semibold text-sm py-3 transition"
type="submit"
>
{mode === 'signin' ? $i18n.t('Sign in') : $i18n.t('Create Account')}
...
...
src/routes/s/[id]/+page.svelte
View file @
e31cf081
...
...
@@ -138,7 +138,7 @@
class="min-h-screen max-h-screen w-full flex flex-col text-gray-700 dark:text-gray-100 bg-white dark:bg-gray-900"
>
<div class="flex flex-col flex-auto justify-center py-8">
<div class="px-3 w-full max-w-
3
xl mx-auto">
<div class="px-3 w-full max-w-
5
xl mx-auto">
<div>
<div class=" text-3xl font-semibold line-clamp-1">
{title}
...
...
Prev
1
2
3
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