forked from open-webui/open-webui
Merge branch 'dev' into litellm-as-subprocess
This commit is contained in:
commit
56c93bc2ac
3 changed files with 30 additions and 31 deletions
|
@ -195,7 +195,7 @@ class ImageGenerationPayload(BaseModel):
|
||||||
def comfyui_generate_image(
|
def comfyui_generate_image(
|
||||||
model: str, payload: ImageGenerationPayload, client_id, base_url
|
model: str, payload: ImageGenerationPayload, client_id, base_url
|
||||||
):
|
):
|
||||||
host = base_url.replace("http://", "").replace("https://", "")
|
ws_url = base_url.replace("http://", "ws://").replace("https://", "wss://")
|
||||||
|
|
||||||
comfyui_prompt = json.loads(COMFYUI_DEFAULT_PROMPT)
|
comfyui_prompt = json.loads(COMFYUI_DEFAULT_PROMPT)
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ def comfyui_generate_image(
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ws = websocket.WebSocket()
|
ws = websocket.WebSocket()
|
||||||
ws.connect(f"ws://{host}/ws?clientId={client_id}")
|
ws.connect(f"{ws_url}/ws?clientId={client_id}")
|
||||||
log.info("WebSocket connection established.")
|
log.info("WebSocket connection established.")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.exception(f"Failed to connect to WebSocket server: {e}")
|
log.exception(f"Failed to connect to WebSocket server: {e}")
|
||||||
|
|
|
@ -316,8 +316,13 @@
|
||||||
console.log(e);
|
console.log(e);
|
||||||
|
|
||||||
if (e.dataTransfer?.files) {
|
if (e.dataTransfer?.files) {
|
||||||
let reader = new FileReader();
|
const inputFiles = Array.from(e.dataTransfer?.files);
|
||||||
|
|
||||||
|
if (inputFiles && inputFiles.length > 0) {
|
||||||
|
inputFiles.forEach((file) => {
|
||||||
|
console.log(file, file.name.split('.').at(-1));
|
||||||
|
if (['image/gif', 'image/jpeg', 'image/png'].includes(file['type'])) {
|
||||||
|
let reader = new FileReader();
|
||||||
reader.onload = (event) => {
|
reader.onload = (event) => {
|
||||||
files = [
|
files = [
|
||||||
...files,
|
...files,
|
||||||
|
@ -327,13 +332,6 @@
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
const inputFiles = Array.from(e.dataTransfer?.files);
|
|
||||||
|
|
||||||
if (inputFiles && inputFiles.length > 0) {
|
|
||||||
inputFiles.forEach((file) => {
|
|
||||||
console.log(file, file.name.split('.').at(-1));
|
|
||||||
if (['image/gif', 'image/jpeg', 'image/png'].includes(file['type'])) {
|
|
||||||
reader.readAsDataURL(file);
|
reader.readAsDataURL(file);
|
||||||
} else if (
|
} else if (
|
||||||
SUPPORTED_FILE_TYPE.includes(file['type']) ||
|
SUPPORTED_FILE_TYPE.includes(file['type']) ||
|
||||||
|
@ -470,6 +468,10 @@
|
||||||
hidden
|
hidden
|
||||||
multiple
|
multiple
|
||||||
on:change={async () => {
|
on:change={async () => {
|
||||||
|
if (inputFiles && inputFiles.length > 0) {
|
||||||
|
const _inputFiles = Array.from(inputFiles);
|
||||||
|
_inputFiles.forEach((file) => {
|
||||||
|
if (['image/gif', 'image/jpeg', 'image/png'].includes(file['type'])) {
|
||||||
let reader = new FileReader();
|
let reader = new FileReader();
|
||||||
reader.onload = (event) => {
|
reader.onload = (event) => {
|
||||||
files = [
|
files = [
|
||||||
|
@ -482,11 +484,6 @@
|
||||||
inputFiles = null;
|
inputFiles = null;
|
||||||
filesInputElement.value = '';
|
filesInputElement.value = '';
|
||||||
};
|
};
|
||||||
|
|
||||||
if (inputFiles && inputFiles.length > 0) {
|
|
||||||
const _inputFiles = Array.from(inputFiles);
|
|
||||||
_inputFiles.forEach((file) => {
|
|
||||||
if (['image/gif', 'image/jpeg', 'image/png'].includes(file['type'])) {
|
|
||||||
reader.readAsDataURL(file);
|
reader.readAsDataURL(file);
|
||||||
} else if (
|
} else if (
|
||||||
SUPPORTED_FILE_TYPE.includes(file['type']) ||
|
SUPPORTED_FILE_TYPE.includes(file['type']) ||
|
||||||
|
|
|
@ -67,7 +67,7 @@
|
||||||
<div class="flex flex-col md:flex-row w-full px-5 py-4 md:space-x-4 dark:text-gray-200">
|
<div class="flex flex-col md:flex-row w-full px-5 py-4 md:space-x-4 dark:text-gray-200">
|
||||||
<div class=" flex flex-col w-full sm:flex-row sm:justify-center sm:space-x-6">
|
<div class=" flex flex-col w-full sm:flex-row sm:justify-center sm:space-x-6">
|
||||||
{#if chats.length > 0}
|
{#if chats.length > 0}
|
||||||
<div class="text-left text-sm w-full mb-4">
|
<div class="text-left text-sm w-full mb-4 max-h-[22rem] overflow-y-scroll">
|
||||||
<div class="relative overflow-x-auto">
|
<div class="relative overflow-x-auto">
|
||||||
<table class="w-full text-sm text-left text-gray-500 dark:text-gray-400 table-auto">
|
<table class="w-full text-sm text-left text-gray-500 dark:text-gray-400 table-auto">
|
||||||
<thead
|
<thead
|
||||||
|
@ -75,7 +75,7 @@
|
||||||
>
|
>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col" class="px-3 py-2"> {$i18n.t('Name')} </th>
|
<th scope="col" class="px-3 py-2"> {$i18n.t('Name')} </th>
|
||||||
<th scope="col" class="px-3 py-2"> {$i18n.t('Created At')} </th>
|
<th scope="col" class="px-3 py-2 hidden md:flex"> {$i18n.t('Created At')} </th>
|
||||||
<th scope="col" class="px-3 py-2 text-right" />
|
<th scope="col" class="px-3 py-2 text-right" />
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -93,8 +93,10 @@
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class=" px-3 py-1">
|
<td class=" px-3 py-1 hidden md:flex h-[2.5rem]">
|
||||||
|
<div class="my-auto">
|
||||||
{dayjs(chat.created_at * 1000).format($i18n.t('MMMM DD, YYYY HH:mm'))}
|
{dayjs(chat.created_at * 1000).format($i18n.t('MMMM DD, YYYY HH:mm'))}
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="px-3 py-1 text-right">
|
<td class="px-3 py-1 text-right">
|
||||||
|
|
Loading…
Reference in a new issue