mirror of
https://github.com/hex248/sprint.git
synced 2026-02-07 18:23:03 +00:00
opencode chat frontend implementation
This commit is contained in:
@@ -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>;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user