opencode chat frontend implementation

This commit is contained in:
2026-01-31 11:01:30 +00:00
parent 925e8f2746
commit 76e71d1f8a
12 changed files with 175 additions and 2 deletions

View File

@@ -0,0 +1,15 @@
import type { ChatRequest, ChatResponse } from "@sprint/shared";
import { useMutation } from "@tanstack/react-query";
import { apiClient } from "@/lib/server";
export function useChatMutation() {
return useMutation<ChatResponse, Error, ChatRequest>({
mutationKey: ["ai", "chat"],
mutationFn: async (input) => {
const { data, error } = await apiClient.aiChat({ query: input });
if (error) throw new Error(error);
if (!data) throw new Error("failed to get chat response");
return data as ChatResponse;
},
});
}

View File

@@ -1,3 +1,4 @@
export * from "@/lib/query/hooks/chat";
export * from "@/lib/query/hooks/derived";
export * from "@/lib/query/hooks/issue-comments";
export * from "@/lib/query/hooks/issues";