Fix message types
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import type { Message } from "ai";
|
import type { Message } from "@/ipc/ipc_types";
|
||||||
import { atom } from "jotai";
|
import { atom } from "jotai";
|
||||||
import type { ChatSummary } from "@/lib/schemas";
|
import type { ChatSummary } from "@/lib/schemas";
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { memo } from "react";
|
import { memo } from "react";
|
||||||
import type { Message } from "ai";
|
import type { Message } from "@/ipc/ipc_types";
|
||||||
import { DyadMarkdownParser } from "./DyadMarkdownParser";
|
import { DyadMarkdownParser } from "./DyadMarkdownParser";
|
||||||
import { motion } from "framer-motion";
|
import { motion } from "framer-motion";
|
||||||
import { useStreamChat } from "@/hooks/useStreamChat";
|
import { useStreamChat } from "@/hooks/useStreamChat";
|
||||||
@@ -66,6 +66,19 @@ const ChatMessage = ({ message }: ChatMessageProps) => {
|
|||||||
<DyadMarkdownParser content={message.content} />
|
<DyadMarkdownParser content={message.content} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{message.approvalState && (
|
||||||
|
<div className="mt-2 text-xs">
|
||||||
|
{message.approvalState === "approved" ? (
|
||||||
|
<div className="bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200 p-1 rounded">
|
||||||
|
Approved
|
||||||
|
</div>
|
||||||
|
) : message.approvalState === "rejected" ? (
|
||||||
|
<div className="bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200 p-1 rounded">
|
||||||
|
Rejected
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type React from "react";
|
import type React from "react";
|
||||||
import type { Message } from "ai";
|
import type { Message } from "@/ipc/ipc_types";
|
||||||
import { forwardRef } from "react";
|
import { forwardRef } from "react";
|
||||||
import ChatMessage from "./ChatMessage";
|
import ChatMessage from "./ChatMessage";
|
||||||
import { SetupBanner } from "../SetupBanner";
|
import { SetupBanner } from "../SetupBanner";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useCallback, useState } from "react";
|
import { useCallback, useState } from "react";
|
||||||
import type { Message } from "ai";
|
import type { Message } from "@/ipc/ipc_types";
|
||||||
import { useAtom, useSetAtom } from "jotai";
|
import { useAtom, useSetAtom } from "jotai";
|
||||||
import {
|
import {
|
||||||
chatErrorAtom,
|
chatErrorAtom,
|
||||||
|
|||||||
@@ -50,9 +50,17 @@ const getProposalHandler = async (
|
|||||||
columns: {
|
columns: {
|
||||||
id: true, // Fetch the ID
|
id: true, // Fetch the ID
|
||||||
content: true, // Fetch the content to parse
|
content: true, // Fetch the content to parse
|
||||||
|
approvalState: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (
|
||||||
|
latestAssistantMessage?.approvalState === "approved" ||
|
||||||
|
latestAssistantMessage?.approvalState === "rejected"
|
||||||
|
) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (latestAssistantMessage?.content && latestAssistantMessage.id) {
|
if (latestAssistantMessage?.content && latestAssistantMessage.id) {
|
||||||
const messageId = latestAssistantMessage.id; // Get the message ID
|
const messageId = latestAssistantMessage.id; // Get the message ID
|
||||||
console.log(
|
console.log(
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import type { Message } from "ai";
|
|
||||||
import type { IpcRenderer } from "electron";
|
import type { IpcRenderer } from "electron";
|
||||||
import {
|
import {
|
||||||
type ChatSummary,
|
type ChatSummary,
|
||||||
@@ -15,6 +14,7 @@ import type {
|
|||||||
CreateAppResult,
|
CreateAppResult,
|
||||||
ListAppsResponse,
|
ListAppsResponse,
|
||||||
NodeSystemInfo,
|
NodeSystemInfo,
|
||||||
|
Message,
|
||||||
Version,
|
Version,
|
||||||
} from "./ipc_types";
|
} from "./ipc_types";
|
||||||
import type { Proposal } from "@/lib/schemas";
|
import type { Proposal } from "@/lib/schemas";
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import type { Message } from "ai";
|
|
||||||
|
|
||||||
export interface AppOutput {
|
export interface AppOutput {
|
||||||
type: "stdout" | "stderr" | "info" | "client-error";
|
type: "stdout" | "stderr" | "info" | "client-error";
|
||||||
message: string;
|
message: string;
|
||||||
@@ -37,6 +35,13 @@ export interface CreateAppResult {
|
|||||||
chatId: number;
|
chatId: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface Message {
|
||||||
|
id: string;
|
||||||
|
role: "user" | "assistant";
|
||||||
|
content: string;
|
||||||
|
approvalState?: "approved" | "rejected";
|
||||||
|
}
|
||||||
|
|
||||||
export interface Chat {
|
export interface Chat {
|
||||||
id: number;
|
id: number;
|
||||||
title: string;
|
title: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user