Skip to content

Commit

Permalink
Tdy react error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon committed May 16, 2024
1 parent 50f65e4 commit c0bf05c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
38 changes: 20 additions & 18 deletions public/assets/js/aibot.pack.js
Original file line number Diff line number Diff line change
Expand Up @@ -332085,18 +332085,24 @@ const ConversationRow = (props) => {
const conversationContentRowClasses = conversationContentRowStyles();
const conversationContentColumnClasses = conversationContentColumnStyles();
const footerSectionClasses = (0, ColumnStyles_1.innerColumnFooterStyles)();
const alwaysScrollToBottomId = "AlwaysScrollToBottom";
// Shorthand only
let conversation = props.conversation;
let audience = props.audience;
function onSend(messageText_) {
props.onSend(messageText_);
scroll();
}
// https://stackoverflow.com/questions/45719909/scroll-to-bottom-of-an-overflowing-div-in-react
const AlwaysScrollToBottom = () => {
const elementRef = (0, react_1.useRef)();
(0, react_1.useEffect)(() => elementRef.current.scrollIntoView());
return react_1.default.createElement("div", { ref: elementRef });
};
// https://stackoverflow.com/questions/45719909/scroll-to-bottom-of-an-overflowing-div-in-react
function scroll() {
const divScroll = document.getElementById(alwaysScrollToBottomId);
if (divScroll) {
divScroll.scrollIntoView();
}
}
(0, react_1.useEffect)(() => {
scroll();
});
if (!props.isConnected) {
return (react_1.default.createElement("div", null));
}
Expand All @@ -332110,7 +332116,7 @@ const ConversationRow = (props) => {
conversation.map(message => {
return (react_1.default.createElement(exports.SingleMessageView, { sessionKey: props.sessionKey, message: message, key: message.id, author: Persona_1.Persona.safeAuthorLookup(audience, message.authorId), showAiWarning: message.authorId === ConfigStrings_1.EConfigStrings.kLLMGuid, onClickUrl: props.onClickUrl }));
}),
react_1.default.createElement(AlwaysScrollToBottom, null))),
react_1.default.createElement("div", { id: alwaysScrollToBottomId }))),
"\u00A0",
react_1.default.createElement("div", { className: footerSectionClasses.root },
props.isBusy ? react_1.default.createElement(DefaultSpinner, null) : react_1.default.createElement("div", null),
Expand Down Expand Up @@ -332283,9 +332289,6 @@ const SingleMessageView = (props) => {
react_1.default.createElement("div", { className: padAfterMessageClasses.root }))));
};
exports.SingleMessageView = SingleMessageView;
const SendButton = (props) => {
return (react_1.default.createElement(react_components_1.Button, { ...props, appearance: "transparent", icon: react_1.default.createElement(react_icons_1.Send24Regular, null), size: "medium" }));
};
const inputGroupStyles = (0, react_components_1.makeStyles)({
root: {
display: 'flex',
Expand Down Expand Up @@ -332349,8 +332352,7 @@ const InputView = (props) => {
"\u00A0",
react_1.default.createElement("div", { className: inputRowClasses.root },
react_1.default.createElement("div", { className: textColumnClasses.root },
react_1.default.createElement(react_components_1.Tooltip, { content: UIStrings_1.EUIStrings.kSendMessagePrompt, relationship: "label", positioning: 'above' },
react_1.default.createElement(MessagePrompt_1.MessagePrompt, { onSend: onSend, onChange: onChange, message: message }))),
react_1.default.createElement(MessagePrompt_1.MessagePrompt, { onSend: onSend, onChange: onChange, message: message })),
"\u00A0",
react_1.default.createElement("div", { className: buttonColumnClasses.root },
react_1.default.createElement("div", { className: buttonRowClasses.root },
Expand Down Expand Up @@ -332766,12 +332768,12 @@ function calculateDyNeeded(width, value) {
exports.calculateDyNeeded = calculateDyNeeded;
const MessagePrompt = (props) => {
const textFieldClasses = textFieldStyles();
const ref = (0, react_1.useRef)(null);
const [width, setWidth] = (0, react_1.useState)(0);
const textAreaId = "textAreaId;";
(0, react_1.useLayoutEffect)(() => {
(0, Asserts_1.throwIfNull)(ref.current);
if (ref.current) {
let dx = ref.current.offsetWidth;
const textArea = document.getElementById(textAreaId);
if (textArea) {
let dx = textArea.offsetWidth;
if (width !== dx) {
setWidth(dx);
}
Expand Down Expand Up @@ -332812,7 +332814,7 @@ const MessagePrompt = (props) => {
if (width !== 0)
dyNeeded = calculateDyNeeded(width, props.message) + bump;
return (react_1.default.createElement("div", { className: textFieldClasses.root },
react_1.default.createElement(react_components_1.Textarea, { ref: ref, appearance: "outline", placeholder: UIStrings_1.EUIStrings.kSendMessagePlaceholder, maxLength: ConfigStrings_1.EConfigNumbers.kMessagePromptMaxCharacters, textarea: { className: textFieldClasses.textarea }, resize: "none", value: props.message, onChange: onKeyChange, style: {
react_1.default.createElement(react_components_1.Textarea, { id: textAreaId, appearance: "outline", placeholder: UIStrings_1.EUIStrings.kSendMessagePlaceholder, maxLength: ConfigStrings_1.EConfigNumbers.kMessagePromptMaxCharacters, textarea: { className: textFieldClasses.textarea }, resize: "none", value: props.message, onChange: onKeyChange, style: {
height: (dyNeeded).toString() + 'px',
width: '100%'
}, onKeyDown: (e) => onSend(e, props.message), disabled: false, autoFocus: true }),
Expand Down Expand Up @@ -334154,7 +334156,7 @@ async function startEmbeddingFileDownload() {
url = ConfigStrings_1.EConfigStrings.kEmbeddingFileUrlProduction;
}
let startTime = new Date();
const response = await fetch(ConfigStrings_1.EConfigStrings.kEmbeddingFileUrlLocal, {
const response = await fetch(url, {
method: "GET",
mode: "same-origin",
cache: "default",
Expand Down
2 changes: 1 addition & 1 deletion public/assets/js/aibot.pack.js.map

Large diffs are not rendered by default.

0 comments on commit c0bf05c

Please sign in to comment.