Skip to content

Commit

Permalink
refactor ui of clipboard inspector
Browse files Browse the repository at this point in the history
  • Loading branch information
tahouse committed Feb 24, 2025
1 parent 6c61a2e commit 03fab2b
Show file tree
Hide file tree
Showing 4 changed files with 513 additions and 189 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "streamlit-chat-prompt"
version = "0.3.12"
version = "0.3.13"
description = "A streamlit custom component that allows you to create a chat prompt with paste and image attachment support"
readme = { file = "README.md", content-type = "text/markdown" }
authors = [
Expand Down
11 changes: 10 additions & 1 deletion streamlit_chat_prompt/frontend/src/components/ChatInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
import { checkFileSize, processImage } from "../utils/images";
import { Logger } from "../utils/logger";
import { generateUUID } from "../utils/uuid";
import { ClipboardInspector, ClipboardItem, DIALOG_HEIGHTS, inspectClipboard } from "./ClipboardInspector";
import { ClipboardInspector, ClipboardInspectorData, ClipboardItem, DIALOG_HEIGHTS, inspectClipboard } from "./ClipboardInspector";
import { PromptData } from "./PromptData";
import { Props } from "./Props";
import { State } from "./State";
Expand Down Expand Up @@ -733,6 +733,15 @@ export class ChatInput extends StreamlitComponentBase<State, Props> {
theme={this.props.theme}
onClose={this.handleCloseDialog}
onSelect={this.handleClipboardSelection}
setData={(value: React.SetStateAction<ClipboardInspectorData[]>) => {
const newData = typeof value === 'function' ? value(this.state.clipboardInspector.data) : value;
this.setState({
clipboardInspector: {
...this.state.clipboardInspector,
data: newData
}
});
}}
/>
<Snackbar
open={this.state.notification.open}
Expand Down
Loading

0 comments on commit 03fab2b

Please sign in to comment.