flue flow fixes
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { ThemeProvider as NextThemesProvider } from "next-themes";
|
||||
import * as React from "react";
|
||||
|
||||
export function ThemeProvider({
|
||||
export const ThemeProvider = ({
|
||||
children,
|
||||
...props
|
||||
}: React.ComponentProps<typeof NextThemesProvider>) {
|
||||
return <NextThemesProvider {...props}>{children}</NextThemesProvider>;
|
||||
}
|
||||
}: React.ComponentProps<typeof NextThemesProvider>) => (
|
||||
<NextThemesProvider {...props}>{children}</NextThemesProvider>
|
||||
);
|
||||
|
||||
export { useTheme } from "next-themes";
|
||||
|
||||
@@ -56,4 +56,39 @@ describe("projectConversation", () => {
|
||||
{ state: "done", text: "Captured the request.", type: "text" },
|
||||
]);
|
||||
});
|
||||
|
||||
test("clears a historical failure after a newer turn succeeds", () => {
|
||||
const state = projectConversation([
|
||||
row({
|
||||
error: "Old admission failure",
|
||||
messageId: "assistant-failed",
|
||||
role: "assistant",
|
||||
status: "failed",
|
||||
}),
|
||||
row({
|
||||
messageId: "assistant-completed",
|
||||
rawText: "Recovered",
|
||||
role: "assistant",
|
||||
status: "completed",
|
||||
}),
|
||||
]);
|
||||
expect(state.failedError).toBeUndefined();
|
||||
});
|
||||
|
||||
test("clears historical pending state after a newer turn completes", () => {
|
||||
const state = projectConversation([
|
||||
row({
|
||||
messageId: "assistant-stale",
|
||||
role: "assistant",
|
||||
status: "running",
|
||||
}),
|
||||
row({
|
||||
messageId: "assistant-completed",
|
||||
rawText: "Recovered",
|
||||
role: "assistant",
|
||||
status: "completed",
|
||||
}),
|
||||
]);
|
||||
expect(state.pending).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -20,7 +20,18 @@ export interface ConversationRow {
|
||||
| "running";
|
||||
}
|
||||
|
||||
const latestAssistant = (
|
||||
rows: readonly ConversationRow[]
|
||||
): ConversationRow | undefined =>
|
||||
rows.findLast((row) => row.role === "assistant");
|
||||
|
||||
const latestTerminalError = (row: ConversationRow | undefined) =>
|
||||
row?.status === "failed"
|
||||
? (row.error ?? "Conversation turn failed")
|
||||
: undefined;
|
||||
|
||||
export const projectConversation = (rows: readonly ConversationRow[]) => {
|
||||
const activeAssistant = latestAssistant(rows);
|
||||
const streaming = rows.some(
|
||||
(row) =>
|
||||
row.role === "assistant" &&
|
||||
@@ -28,9 +39,7 @@ export const projectConversation = (rows: readonly ConversationRow[]) => {
|
||||
row.rawText.length > 0
|
||||
);
|
||||
return {
|
||||
failedError: rows.findLast(
|
||||
(row) => row.role === "assistant" && row.status === "failed"
|
||||
)?.error,
|
||||
failedError: latestTerminalError(activeAssistant),
|
||||
messages: rows
|
||||
.filter(
|
||||
(row) =>
|
||||
@@ -65,13 +74,10 @@ export const projectConversation = (rows: readonly ConversationRow[]) => {
|
||||
],
|
||||
role: row.role,
|
||||
})),
|
||||
pending: rows.some(
|
||||
(row) =>
|
||||
row.role === "assistant" &&
|
||||
(row.status === "queued" ||
|
||||
row.status === "dispatching" ||
|
||||
row.status === "running")
|
||||
),
|
||||
pending:
|
||||
activeAssistant?.status === "queued" ||
|
||||
activeAssistant?.status === "dispatching" ||
|
||||
activeAssistant?.status === "running",
|
||||
streaming,
|
||||
};
|
||||
};
|
||||
|
||||
+20
-15
@@ -2,22 +2,27 @@ import path from "node:path";
|
||||
|
||||
import { reactRouter } from "@react-router/dev/vite";
|
||||
import tailwindcss from "@tailwindcss/vite";
|
||||
import { defineConfig } from "vite-plus";
|
||||
import { defineConfig, loadEnv } from "vite-plus";
|
||||
|
||||
export default defineConfig({
|
||||
envDir: path.resolve(import.meta.dirname, "../.."),
|
||||
plugins: [tailwindcss(), reactRouter()],
|
||||
resolve: {
|
||||
dedupe: ["convex", "react", "react-dom"],
|
||||
tsconfigPaths: true,
|
||||
},
|
||||
server: {
|
||||
allowedHosts: true,
|
||||
proxy: {
|
||||
"/api/auth": {
|
||||
changeOrigin: true,
|
||||
target: "https://befitting-dalmatian-161.convex.site",
|
||||
export default defineConfig(({ mode }) => {
|
||||
const envDir = path.resolve(import.meta.dirname, "../..");
|
||||
const env = loadEnv(mode, envDir, "");
|
||||
|
||||
return {
|
||||
envDir,
|
||||
plugins: [tailwindcss(), reactRouter()],
|
||||
resolve: {
|
||||
dedupe: ["convex", "react", "react-dom"],
|
||||
tsconfigPaths: true,
|
||||
},
|
||||
server: {
|
||||
allowedHosts: true,
|
||||
proxy: {
|
||||
"/api/auth": {
|
||||
changeOrigin: true,
|
||||
target: env.CONVEX_SITE_URL,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user