mirror of
https://github.com/ollama/ollama.git
synced 2026-10-20 18:41:17 +00:00
Merge 2743a9ec31 into c1c536297f
This commit is contained in:
commit
fedadff303
5 changed files with 18 additions and 16 deletions
|
|
@ -102,9 +102,9 @@ function ChatForm({
|
|||
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||
const textareaRef = useRef<HTMLTextAreaElement>(null);
|
||||
const thinkButtonRef = useRef<HTMLButtonElement>(null);
|
||||
const thinkingLevelButtonRef = useRef<HTMLButtonElement>(null);
|
||||
const thinkingLevelButtonRef = useRef<HTMLButtonElement & { closeDropdown?: () => void }>(null);
|
||||
const webSearchButtonRef = useRef<HTMLButtonElement>(null);
|
||||
const modelPickerRef = useRef<HTMLButtonElement>(null);
|
||||
const modelPickerRef = useRef<HTMLButtonElement & { closeDropdown?: () => void }>(null);
|
||||
const submitButtonRef = useRef<HTMLButtonElement>(null);
|
||||
|
||||
const { mutate: sendMessageMutation } = useSendMessage(chatId);
|
||||
|
|
@ -126,9 +126,9 @@ function ChatForm({
|
|||
if (
|
||||
isOpen &&
|
||||
modelPickerRef.current &&
|
||||
(modelPickerRef.current as any).closeDropdown
|
||||
modelPickerRef.current.closeDropdown
|
||||
) {
|
||||
(modelPickerRef.current as any).closeDropdown();
|
||||
modelPickerRef.current.closeDropdown();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -136,9 +136,9 @@ function ChatForm({
|
|||
if (
|
||||
isOpen &&
|
||||
thinkingLevelButtonRef.current &&
|
||||
(thinkingLevelButtonRef.current as any).closeDropdown
|
||||
thinkingLevelButtonRef.current.closeDropdown
|
||||
) {
|
||||
(thinkingLevelButtonRef.current as any).closeDropdown();
|
||||
thinkingLevelButtonRef.current.closeDropdown();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ export default function MessageList({
|
|||
onEditMessage?: (content: string, index: number) => void | Promise<void>;
|
||||
editingMessageIndex?: number;
|
||||
error?: ErrorEvent | null;
|
||||
browserToolResult?: any;
|
||||
browserToolResult?: { page_stack: string[] };
|
||||
}) {
|
||||
const [showDots, setShowDots] = React.useState(false);
|
||||
const isDownloadingModel = downloadProgress && !downloadProgress.done;
|
||||
|
|
@ -54,9 +54,9 @@ export default function MessageList({
|
|||
const queries: (string | undefined)[] = [];
|
||||
let lastQuery: string | undefined = undefined;
|
||||
for (let i = 0; i < messages.length; i++) {
|
||||
const m: any = messages[i] as any;
|
||||
const toolCalls: any[] | undefined = Array.isArray(m?.tool_calls)
|
||||
? (m.tool_calls as any[])
|
||||
const m = messages[i];
|
||||
const toolCalls = Array.isArray(m?.tool_calls)
|
||||
? m.tool_calls
|
||||
: m?.tool_call
|
||||
? [m.tool_call]
|
||||
: undefined;
|
||||
|
|
|
|||
|
|
@ -89,7 +89,8 @@ export const ModelPicker = forwardRef<
|
|||
|
||||
useEffect(() => {
|
||||
if (ref && typeof ref === "object" && ref.current) {
|
||||
(ref.current as any).closeDropdown = () => setIsOpen(false);
|
||||
const mutableRef = ref as React.MutableRefObject<HTMLButtonElement & { closeDropdown?: () => void }>;
|
||||
mutableRef.current.closeDropdown = () => setIsOpen(false);
|
||||
}
|
||||
}, [ref, setIsOpen]);
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@ export const ThinkButton = forwardRef<HTMLButtonElement, ThinkButtonProps>(
|
|||
ref.current &&
|
||||
mode === "thinkingLevel"
|
||||
) {
|
||||
(ref.current as any).closeDropdown = () => setIsDropdownOpen(false);
|
||||
const mutableRef = ref as React.MutableRefObject<HTMLButtonElement & { closeDropdown?: () => void }>;
|
||||
mutableRef.current.closeDropdown = () => setIsDropdownOpen(false);
|
||||
}
|
||||
}, [ref, mode]);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { getChats, getChat, sendMessage, type ChatEventUnion } from "../api";
|
||||
import { Chat, ErrorEvent, Model } from "@/gotypes";
|
||||
import { Chat, ChatEvent, ErrorEvent, Model } from "@/gotypes";
|
||||
import { Message } from "@/gotypes";
|
||||
import { useSelectedModel } from "./useSelectedModel";
|
||||
import { createQueryBatcher } from "./useQueryBatcher";
|
||||
|
|
@ -568,9 +568,9 @@ export const useSendMessage = (chatId: string) => {
|
|||
thinkingTimeEnd: event.thinkingTimeEnd,
|
||||
}),
|
||||
{
|
||||
tool_result: (event as any).toolResultData,
|
||||
...((event as any).toolName
|
||||
? { tool_name: (event as any).toolName }
|
||||
tool_result: (event as ChatEvent).toolResultData,
|
||||
...((event as ChatEvent).toolName
|
||||
? { tool_name: (event as ChatEvent).toolName }
|
||||
: {}),
|
||||
},
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue