langflow 当构建失败时,输出窗口的高度太小,

2hh7jdfx  于 2个月前  发布在  其他
关注(0)|答案(2)|浏览(34)

Bug描述

重现步骤

预期行为

根据高度自适应调整

谁能帮忙?

  • 无响应*

操作系统

macos

Langflow版本

1.0.14

Python版本

3.12

截图

  • 无响应*

流程文件

  • 无响应*
kdfy810k

kdfy810k1#

嘿,@YeKelvin!我在这里帮助你解决bug、问题和贡献。让我们一起解决你面临的问题。
要使输出窗口的高度在构建失败时适应内容,你可以修改包含输出的 div 类中的 max-h-96 类,以便根据内容使用动态高度。以下是带有必要更改的相关代码部分:

<div className="mb-2 mt-2 flex justify-center font-semibold text-muted-foreground">
  Output
</div>
<div className="overflow-auto font-normal custom-scroll" style={{ maxHeight: 'auto' }}>
  {validationString.split("\n").map((line, index) => (
    <div className="font-normal" key={index}>
      {line}
    </div>
  ))}
</div>

通过将 maxHeight 设置为 auto ,输出窗口的高度将根据内容动态调整。此外,你可以使用与 langflow 项目中 CodeAreaModal 组件中显示的方法类似的方法,其中高度根据错误的存在而调整:

useEffect(() => {
  const delayedFunction = setTimeout(() => {
    if (error?.detail.error !== undefined) {
      setHeight("90%");
    }
  }, 600);

  return () => {
    clearTimeout(delayedFunction);
  };
}, [error, setHeight]);

return (
  <div className="flex h-full w-full flex-col transition-all">
    <div className="h-full w-full">
      <AceEditor
        readOnly={readonly}
        value={code}
        mode="python"
        setOptions={{ fontFamily: "monospace" }}
        height={height ?? "100%"}
        highlightActiveLine={true}
        showPrintMargin={false}
        fontSize={14}
        showGutter
        enableLiveAutocompletion
        theme={dark ? "twilight" : "github"}
        name="CodeEditor"
        onChange={(value) => {
          setCode(value);
        }}
        className="h-full w-full rounded-lg border-[1px] border-gray-300 custom-scroll dark:border-gray-600"
      />
    </div>
    <div
      className={
        "whitespace-break-spaces transition-all delay-500" +
        (error?.detail?.error !== undefined ? "h-2/6" : "h-0")
      }
    >
      <div className="mt-5 h-full max-h-[10rem] w-full overflow-y-auto overflow-x-clip text-left custom-scroll">
        <h1 className="text-lg text-error">{error?.detail?.error}</h1>
        <div className="ml-2 mt-2 w-full text-sm text-destructive word-break-break-word">
          <span className="w-full word-break-break-word">
            {error?.detail?.traceback}
          </span>
        </div>
      </div>
    </div>
    <div className="flex h-fit w-full justify-end">
      <Button
        className="mt-3"
        onClick={handleClick}
        type="submit"
        id="checkAndSaveBtn"
        disabled={readonly}
      >
        Check & Save
      </Button>
    </div>
  </div>
);

这种方法确保输出窗口的高度根据内容动态调整,从而提供更好的用户体验。

  • 要继续与 @dosu 交谈,请提及 @dosu。*

相关问题