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

@@ -672,3 +672,14 @@ export const ChatRequestSchema = z.object({
projectId: z.coerce.number().int().positive("projectId must be a positive integer"),
message: z.string().min(1, "Message is required"),
});
export type ChatRequest = z.infer<typeof ChatRequestSchema>;
export const ChatResponseSchema = z.object({
text: z.string(),
highlighted_issues: z.array(z.number()),
suggested_actions: z.array(z.string()).nullable(),
raw: z.string(),
});
export type ChatResponse = z.infer<typeof ChatResponseSchema>;

View File

@@ -4,6 +4,8 @@ import {
ApiErrorSchema,
AuthResponseSchema,
CancelSubscriptionResponseSchema,
ChatRequestSchema,
ChatResponseSchema,
CreateCheckoutSessionRequestSchema,
CreateCheckoutSessionResponseSchema,
CreatePortalSessionResponseSchema,
@@ -683,6 +685,17 @@ export const apiContract = c.router({
},
headers: csrfHeaderSchema,
},
aiChat: {
method: "GET",
path: "/ai/chat",
query: ChatRequestSchema,
responses: {
200: ChatResponseSchema,
400: ApiErrorSchema,
404: ApiErrorSchema,
},
},
});
export type ApiContract = typeof apiContract;

View File

@@ -2,6 +2,8 @@ export type {
ApiError,
AuthResponse,
CancelSubscriptionResponse,
ChatRequest,
ChatResponse,
CreateCheckoutSessionRequest,
CreateCheckoutSessionResponse,
CreatePortalSessionResponse,
@@ -70,6 +72,8 @@ export {
ApiErrorSchema,
AuthResponseSchema,
CancelSubscriptionResponseSchema,
ChatRequestSchema,
ChatResponseSchema,
CreateCheckoutSessionRequestSchema,
CreateCheckoutSessionResponseSchema,
CreatePortalSessionResponseSchema,
@@ -135,7 +139,6 @@ export {
UserResponseSchema,
UserUpdateRequestSchema,
VerifyEmailRequestSchema,
ChatRequestSchema,
} from "./api-schemas";
export {
ISSUE_COMMENT_MAX_LENGTH,