gradio-pr-bot commited on
Commit
cb1b81e
·
verified ·
1 Parent(s): 4174d3c

Upload folder using huggingface_hub

Browse files
6.2.0/chatbot/Index.svelte CHANGED
@@ -70,9 +70,11 @@
70
  likeable={gradio.props.likeable}
71
  feedback_options={gradio.props.feedback_options}
72
  feedback_value={gradio.props.feedback_value}
73
- show_share_button={(gradio.props.buttons ?? ["share"]).includes("share")}
74
- show_copy_all_button={(gradio.props.buttons ?? ["copy_all"]).includes(
75
- "copy_all"
 
 
76
  )}
77
  value={_value}
78
  latex_delimiters={gradio.props.latex_delimiters}
@@ -84,7 +86,13 @@
84
  pending_message={gradio.shared.loading_status?.status === "pending"}
85
  generating={gradio.shared.loading_status?.status === "generating"}
86
  rtl={gradio.props.rtl}
87
- show_copy_button={(gradio.props.buttons ?? ["copy"]).includes("copy")}
 
 
 
 
 
 
88
  like_user_message={gradio.props.like_user_message}
89
  show_progress={gradio.shared.loading_status?.show_progress || "full"}
90
  on:change={() => (
 
70
  likeable={gradio.props.likeable}
71
  feedback_options={gradio.props.feedback_options}
72
  feedback_value={gradio.props.feedback_value}
73
+ show_share_button={(gradio.props.buttons ?? ["share"]).some(
74
+ (btn) => typeof btn === "string" && btn === "share"
75
+ )}
76
+ show_copy_all_button={(gradio.props.buttons ?? ["copy_all"]).some(
77
+ (btn) => typeof btn === "string" && btn === "copy_all"
78
  )}
79
  value={_value}
80
  latex_delimiters={gradio.props.latex_delimiters}
 
86
  pending_message={gradio.shared.loading_status?.status === "pending"}
87
  generating={gradio.shared.loading_status?.status === "generating"}
88
  rtl={gradio.props.rtl}
89
+ show_copy_button={(gradio.props.buttons ?? ["copy"]).some(
90
+ (btn) => typeof btn === "string" && btn === "copy"
91
+ )}
92
+ buttons={gradio.props.buttons}
93
+ on_custom_button_click={(id) => {
94
+ gradio.dispatch("custom_button_click", { id });
95
+ }}
96
  like_user_message={gradio.props.like_user_message}
97
  show_progress={gradio.shared.loading_status?.show_progress || "full"}
98
  on:change={() => (
6.2.0/chatbot/package.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "@gradio/chatbot",
3
- "version": "0.28.0",
4
  "description": "Gradio UI packages",
5
  "type": "module",
6
  "author": "",
 
1
  {
2
  "name": "@gradio/chatbot",
3
+ "version": "0.29.0",
4
  "description": "Gradio UI packages",
5
  "type": "module",
6
  "author": "",
6.2.0/chatbot/shared/ChatBot.svelte CHANGED
@@ -24,6 +24,7 @@
24
 
25
  import { Trash, Community, ScrollDownArrow } from "@gradio/icons";
26
  import { IconButtonWrapper, IconButton } from "@gradio/atoms";
 
27
  import type { SelectData, LikeData } from "@gradio/utils";
28
  import type { ExampleMessage } from "../types";
29
  import type { FileData, Client } from "@gradio/client";
@@ -76,6 +77,8 @@
76
  export let show_copy_all_button = false;
77
  export let rtl = false;
78
  export let show_copy_button = false;
 
 
79
  export let avatar_images: [FileData | null, FileData | null] = [null, null];
80
  export let sanitize_html = true;
81
  export let render_markdown = true;
@@ -243,7 +246,7 @@
243
  </script>
244
 
245
  {#if value !== null && value.length > 0}
246
- <IconButtonWrapper>
247
  {#if show_share_button}
248
  <IconButton
249
  Icon={Community}
 
24
 
25
  import { Trash, Community, ScrollDownArrow } from "@gradio/icons";
26
  import { IconButtonWrapper, IconButton } from "@gradio/atoms";
27
+ import type { CustomButton as CustomButtonType } from "@gradio/utils";
28
  import type { SelectData, LikeData } from "@gradio/utils";
29
  import type { ExampleMessage } from "../types";
30
  import type { FileData, Client } from "@gradio/client";
 
77
  export let show_copy_all_button = false;
78
  export let rtl = false;
79
  export let show_copy_button = false;
80
+ export let buttons: (string | CustomButtonType)[] | null = null;
81
+ export let on_custom_button_click: ((id: number) => void) | null = null;
82
  export let avatar_images: [FileData | null, FileData | null] = [null, null];
83
  export let sanitize_html = true;
84
  export let render_markdown = true;
 
246
  </script>
247
 
248
  {#if value !== null && value.length > 0}
249
+ <IconButtonWrapper {buttons} {on_custom_button_click}>
250
  {#if show_share_button}
251
  <IconButton
252
  Icon={Community}
6.2.0/chatbot/types.ts CHANGED
@@ -1,6 +1,12 @@
1
  import type { FileData } from "@gradio/client";
2
  import type { UndoRetryData } from "./shared/utils";
3
- import type { Gradio, SelectData, LikeData, CopyData } from "@gradio/utils";
 
 
 
 
 
 
4
  import type { LoadingStatus } from "@gradio/statustracker";
5
 
6
  export type MessageRole = "system" | "user" | "assistant";
@@ -104,6 +110,7 @@ export interface ChatbotEvents {
104
  undo: UndoRetryData;
105
  clear: null;
106
  copy: CopyData;
 
107
  }
108
 
109
  export interface ChatbotProps {
@@ -130,7 +137,7 @@ export interface ChatbotProps {
130
  likeable: boolean;
131
  feedback_options: string[];
132
  feedback_value: (string | null)[] | null;
133
- buttons: string[] | null;
134
  rtl: boolean;
135
  sanitize_html: boolean;
136
  layout: "bubble" | "panel";
 
1
  import type { FileData } from "@gradio/client";
2
  import type { UndoRetryData } from "./shared/utils";
3
+ import type {
4
+ Gradio,
5
+ SelectData,
6
+ LikeData,
7
+ CopyData,
8
+ CustomButton
9
+ } from "@gradio/utils";
10
  import type { LoadingStatus } from "@gradio/statustracker";
11
 
12
  export type MessageRole = "system" | "user" | "assistant";
 
110
  undo: UndoRetryData;
111
  clear: null;
112
  copy: CopyData;
113
+ custom_button_click: { id: number };
114
  }
115
 
116
  export interface ChatbotProps {
 
137
  likeable: boolean;
138
  feedback_options: string[];
139
  feedback_value: (string | null)[] | null;
140
+ buttons: (string | CustomButton)[] | null;
141
  rtl: boolean;
142
  sanitize_html: boolean;
143
  layout: "bubble" | "panel";