This commit is contained in:
starmorph
2025-05-19 13:06:48 -07:00
parent f1b6aab645
commit 198d13d46d
2 changed files with 20 additions and 5 deletions

View File

@@ -173,7 +173,13 @@ export function Thread() {
const handleSubmit = (e: FormEvent) => {
e.preventDefault();
if ((input.trim().length === 0 && imageUrlList.length === 0 && pdfUrlList.length === 0) || isLoading) return;
if (
(input.trim().length === 0 &&
imageUrlList.length === 0 &&
pdfUrlList.length === 0) ||
isLoading
)
return;
setFirstTokenReceived(false);
// TODO: check configurable object for modelname camelcase or snakecase else do openai format
@@ -639,7 +645,12 @@ export function Thread() {
<Button
type="submit"
className="shadow-md transition-all"
disabled={isLoading || (!input.trim() && imageUrlList.length === 0 && pdfUrlList.length === 0)}
disabled={
isLoading ||
(!input.trim() &&
imageUrlList.length === 0 &&
pdfUrlList.length === 0)
}
>
Send
</Button>

View File

@@ -88,7 +88,7 @@ export function HumanMessage({
<div className="flex flex-col gap-2">
{/* Render images and files if no text */}
{Array.isArray(message.content) && message.content.length > 0 && (
<div className="flex flex-col gap-2 items-end">
<div className="flex flex-col items-end gap-2">
{message.content.map((block, idx) => {
// Type guard for image block
const isImageBlock =
@@ -135,7 +135,9 @@ export function HumanMessage({
key={idx}
className="bg-muted ml-auto w-fit rounded-3xl px-4 py-2 text-right whitespace-pre-wrap"
>
{pdfBlock.metadata?.filename || pdfBlock.metadata?.name || "PDF file"}
{pdfBlock.metadata?.filename ||
pdfBlock.metadata?.name ||
"PDF file"}
</div>
);
}
@@ -144,7 +146,9 @@ export function HumanMessage({
</div>
)}
{/* Render text if present, otherwise fallback to file/image name */}
{contentString && contentString !== "Other" && contentString !== "Multimodal message" ? (
{contentString &&
contentString !== "Other" &&
contentString !== "Multimodal message" ? (
<p className="bg-muted ml-auto w-fit rounded-3xl px-4 py-2 text-right whitespace-pre-wrap">
{contentString}
</p>