Skip to content

Commit

Permalink
Fix duplicate attribute error (#9630)
Browse files Browse the repository at this point in the history
* fix duplicate attribute

* fix duplicate attribute

* add changeset

* add changeset

* format

* add changeset

---------

Co-authored-by: gradio-pr-bot <[email protected]>
Co-authored-by: Abubakar Abid <[email protected]>
  • Loading branch information
3 people authored Oct 9, 2024
1 parent 4b1086e commit 2eaa066
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 35 deletions.
8 changes: 8 additions & 0 deletions .changeset/rich-jeans-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@gradio/chatbot": patch
"@gradio/lite": patch
"@self/app": patch
"gradio": patch
---

fix:Fix duplicate attribute error
36 changes: 22 additions & 14 deletions js/app/src/app.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
<!doctype html >
<html lang="en" style="
margin: 0;
padding: 0;
min-height: 100%;
display: flex;
flex-direction: column;
">
<!doctype html>
<html
lang="en"
style="
margin: 0;
padding: 0;
min-height: 100%;
display: flex;
flex-direction: column;
"
>
<head>
<meta charset="utf-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover" style="width: 100%;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
flex-grow: 1;">
<body
data-sveltekit-preload-data="hover"
style="
width: 100%;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
flex-grow: 1;
"
>
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
14 changes: 7 additions & 7 deletions js/app/src/routes/[...catchall]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
let active_theme_mode: ThemeMode;
let intersecting: ReturnType<typeof create_intersection_store> = {
register: () => {},
subscribe: writable({}).subscribe,
subscribe: writable({}).subscribe
};
$: if (config?.app_id) {
Expand All @@ -126,7 +126,7 @@
message: "",
load_status: "pending",
status: "sleeping",
detail: "SLEEPING",
detail: "SLEEPING"
};
let app: ClientType = data.app;
Expand Down Expand Up @@ -158,7 +158,7 @@
message: "",
load_status: "complete",
status: "running",
detail: "RUNNING",
detail: "RUNNING"
};
css_ready = true;
Expand All @@ -181,7 +181,7 @@
app = await Client.connect(data.api_url, {
status_callback: handle_status,
with_null_state: true,
events: ["data", "log", "status", "render"],
events: ["data", "log", "status", "render"]
});
if (!app.config) {
Expand All @@ -207,8 +207,8 @@
new CustomEvent("render", {
bubbles: true,
cancelable: false,
composed: true,
}),
composed: true
})
);
}
Expand All @@ -219,7 +219,7 @@
async function mount_space_header(
space_id: string | null | undefined,
is_embed: boolean,
is_embed: boolean
): Promise<void> {
if (space_id && !is_embed && window.self === window.top) {
if (spaceheader) {
Expand Down
2 changes: 0 additions & 2 deletions js/chatbot/shared/ButtonPanel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
label="Retry"
on:click={() => handle_action("retry")}
disabled={generating}
label="Retry"
/>
{/if}
{#if show_undo}
Expand All @@ -80,7 +79,6 @@
Icon={Undo}
on:click={() => handle_action("undo")}
disabled={generating}
label="Undo"
/>
{/if}
{#if likeable}
Expand Down
20 changes: 10 additions & 10 deletions js/chatbot/shared/ChatBot.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
is_last_bot_message,
group_messages,
load_components,
get_components_from_messages,
get_components_from_messages
} from "./utils";
import type { NormalisedMessage } from "../types";
import { copy } from "@gradio/utils";
Expand All @@ -18,7 +18,7 @@
type SvelteComponent,
type ComponentType,
tick,
onMount,
onMount
} from "svelte";
import { Image } from "@gradio/image/shared";
Expand Down Expand Up @@ -47,7 +47,7 @@
_components = await load_components(
get_components_from_messages(value),
_components,
load_component,
load_component
);
}
Expand Down Expand Up @@ -190,14 +190,14 @@
function handle_example_select(i: number, example: ExampleMessage): void {
dispatch("example_select", {
index: i,
value: { text: example.text, files: example.files },
value: { text: example.text, files: example.files }
});
}
function handle_like(
i: number,
message: NormalisedMessage,
selected: string | null,
selected: string | null
): void {
if (selected === "undo" || selected === "retry") {
const val_ = value as NormalisedMessage[];
Expand All @@ -209,7 +209,7 @@
}
dispatch(selected, {
index: val_[last_index].index,
value: val_[last_index].content,
value: val_[last_index].content
});
return;
}
Expand All @@ -218,21 +218,21 @@
dispatch("like", {
index: message.index,
value: message.content,
liked: selected === "like",
liked: selected === "like"
});
} else {
if (!groupedMessages) return;
const message_group = groupedMessages[i];
const [first, last] = [
message_group[0],
message_group[message_group.length - 1],
message_group[message_group.length - 1]
];
dispatch("like", {
index: [first.index, last.index] as [number, number],
value: message_group.map((m) => m.content),
liked: selected === "like",
liked: selected === "like"
});
}
}
Expand All @@ -248,7 +248,7 @@
// @ts-ignore
const formatted = await format_chat_for_sharing(value);
dispatch("share", {
description: formatted,
description: formatted
});
} catch (e) {
console.error(e);
Expand Down
4 changes: 2 additions & 2 deletions js/lite/src/Playground.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
} else {
const url = new URL(window.location.toString());
const url_color_mode: ThemeMode | null = url.searchParams.get(
"__theme",
"__theme"
) as ThemeMode | null;
new_theme_mode = theme_mode || url_color_mode || "system";
}
Expand All @@ -61,7 +61,7 @@
function update_scheme(): "light" | "dark" {
let _theme: "light" | "dark" = window?.matchMedia?.(
"(prefers-color-scheme: dark)",
"(prefers-color-scheme: dark)"
).matches
? "dark"
: "light";
Expand Down

0 comments on commit 2eaa066

Please sign in to comment.