提交 34f06996 authored 作者: Will Chen's avatar Will Chen

disable submit button if no provider is setup

上级 2deda728
...@@ -19,7 +19,7 @@ interface ChatInputProps { ...@@ -19,7 +19,7 @@ interface ChatInputProps {
export function ChatInput({ chatId, onSubmit }: ChatInputProps) { export function ChatInput({ chatId, onSubmit }: ChatInputProps) {
const [inputValue, setInputValue] = useAtom(chatInputValueAtom); const [inputValue, setInputValue] = useAtom(chatInputValueAtom);
const textareaRef = useRef<HTMLTextAreaElement>(null); const textareaRef = useRef<HTMLTextAreaElement>(null);
const { settings, updateSettings } = useSettings(); const { settings, updateSettings, isAnyProviderSetup } = useSettings();
const { streamMessage, isStreaming, setIsStreaming, error, setError } = const { streamMessage, isStreaming, setIsStreaming, error, setError } =
useStreamChat(); useStreamChat();
const [selectedAppId] = useAtom(selectedAppIdAtom); const [selectedAppId] = useAtom(selectedAppIdAtom);
...@@ -117,7 +117,7 @@ export function ChatInput({ chatId, onSubmit }: ChatInputProps) { ...@@ -117,7 +117,7 @@ export function ChatInput({ chatId, onSubmit }: ChatInputProps) {
) : ( ) : (
<button <button
onClick={submitHandler} onClick={submitHandler}
disabled={!inputValue.trim()} disabled={!inputValue.trim() || !isAnyProviderSetup()}
className="px-2 py-2 mt-1 mr-2 hover:bg-(--background-darkest) text-(--sidebar-accent-fg) rounded-lg disabled:opacity-50" className="px-2 py-2 mt-1 mr-2 hover:bg-(--background-darkest) text-(--sidebar-accent-fg) rounded-lg disabled:opacity-50"
> >
<SendIcon size={20} /> <SendIcon size={20} />
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论