mirror of
https://github.com/gradio-app/gradio.git
synced 2025-02-05 11:10:03 +08:00
Merge pull request #627 from gradio-app/dawood/webcam_chatbot_fixes
Some webcam + chatbot fixes
This commit is contained in:
commit
d6bfa72ae2
@ -1,21 +1,33 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { beforeUpdate, afterUpdate } from "svelte";
|
||||||
export let value: Array<string>;
|
export let value: Array<string>;
|
||||||
|
let div: HTMLDivElement;
|
||||||
|
let autoscroll: Boolean;
|
||||||
|
|
||||||
|
beforeUpdate(() => {
|
||||||
|
autoscroll =
|
||||||
|
div && div.offsetHeight + div.scrollTop > div.scrollHeight - 20;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterUpdate(() => {
|
||||||
|
if (autoscroll) div.scrollTo(0, div.scrollHeight);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="overflow-y-auto h-64 border border-b-0 rounded-t-lg leading-tight">
|
<div
|
||||||
|
class="overflow-y-auto h-64 border border-b-0 rounded-t-lg leading-tight"
|
||||||
|
bind:this={div}
|
||||||
|
>
|
||||||
<div class="flex flex-col items-end space-y-4 p-3">
|
<div class="flex flex-col items-end space-y-4 p-3">
|
||||||
{#each value as message}
|
{#each value as message}
|
||||||
|
<div class="px-3 py-2 rounded-2xl bg-yellow-500 text-white ml-7">
|
||||||
|
{message[0]}
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
class="px-3 py-2 rounded-2xl place-self-start bg-gray-300 dark:bg-gray-850 dark:text-gray-200 mr-7"
|
class="px-3 py-2 rounded-2xl place-self-start bg-gray-300 dark:bg-gray-850 dark:text-gray-200 mr-7"
|
||||||
>
|
>
|
||||||
{message[1]}
|
{message[1]}
|
||||||
</div>
|
</div>
|
||||||
<div class="px-3 py-2 rounded-2xl bg-yellow-500 text-white ml-7">
|
|
||||||
{message[0]}
|
|
||||||
</div>
|
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style lang="postcss">
|
|
||||||
</style>
|
|
||||||
|
@ -66,3 +66,10 @@
|
|||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<style lang="postcss" global>
|
||||||
|
video {
|
||||||
|
-webkit-transform: scaleX(-1);
|
||||||
|
transform: scaleX(-1);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user