mirror of
https://github.com/temetro/temetro.git
synced 2026-07-26 11:58:14 +00:00
929bec8f31
Stop blocking AI imports/proposals on missing non-critical fields. Records the chat agent drafts now save with safe placeholders, auto-generated file numbers, and a source="ai" marker that surfaces an "Added by AI" badge so a clinician can review/edit them later. Backend: - add `source` (manual|ai) column to patients/appointments/prescriptions (migration 0014) + canonical types, services, validation schemas - relax patient/appointment validation: empty file number allowed, demographic + type/provider/initials fall back to placeholders (initials derived from name) - patients.generateFileNumber() auto-assigns an MRN when one is missing - proposeAppointment accepts a name when no file number resolves; AI commits + /api/ai/import stamp source="ai" Frontend: - `source` on Appointment/Patient/Prescription types; AI commits send source="ai" - reusable <AiBadge> shown on the Patients table/detail and prescriptions list Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
83 lines
2.3 KiB
TypeScript
83 lines
2.3 KiB
TypeScript
"use client";
|
|
|
|
import {
|
|
Terminal,
|
|
TerminalActions,
|
|
TerminalClearButton,
|
|
TerminalContent,
|
|
TerminalCopyButton,
|
|
TerminalHeader,
|
|
TerminalStatus,
|
|
TerminalTitle,
|
|
} from "@/components/ai-elements/terminal";
|
|
import { useCallback, useEffect, useState } from "react";
|
|
|
|
const handleTerminalCopy = () => {
|
|
console.log("Copied!");
|
|
};
|
|
|
|
const ansiOutput = `\u001B[32m✓\u001B[0m Compiled successfully in 1.2s
|
|
|
|
\u001B[1m\u001B[34minfo\u001B[0m - Collecting page data...
|
|
\u001B[1m\u001B[34minfo\u001B[0m - Generating static pages (0/3)
|
|
\u001B[32m✓\u001B[0m Generated static pages (3/3)
|
|
|
|
\u001B[1m\u001B[33mwarn\u001B[0m - Using \u001B[1mexperimental\u001B[0m server actions
|
|
|
|
\u001B[36mRoute (app)\u001B[0m \u001B[36mSize\u001B[0m \u001B[36mFirst Load JS\u001B[0m
|
|
\u001B[37m┌ ○ /\u001B[0m \u001B[32m5.2 kB\u001B[0m \u001B[32m87.3 kB\u001B[0m
|
|
\u001B[37m├ ○ /about\u001B[0m \u001B[32m2.1 kB\u001B[0m \u001B[32m84.2 kB\u001B[0m
|
|
\u001B[37m└ ○ /contact\u001B[0m \u001B[32m3.8 kB\u001B[0m \u001B[32m85.9 kB\u001B[0m
|
|
|
|
\u001B[32m✓\u001B[0m Build completed successfully!
|
|
\u001B[90mTotal time: 3.45s\u001B[0m
|
|
`;
|
|
|
|
const Example = () => {
|
|
const [output, setOutput] = useState("");
|
|
const [isStreaming, setIsStreaming] = useState(true);
|
|
|
|
useEffect(() => {
|
|
let index = 0;
|
|
const interval = setInterval(() => {
|
|
if (index < ansiOutput.length) {
|
|
setOutput(ansiOutput.slice(0, index + 10));
|
|
index += 10;
|
|
} else {
|
|
setIsStreaming(false);
|
|
clearInterval(interval);
|
|
}
|
|
}, 20);
|
|
|
|
return () => clearInterval(interval);
|
|
}, []);
|
|
|
|
const handleClear = useCallback(() => {
|
|
setOutput("");
|
|
setIsStreaming(false);
|
|
}, []);
|
|
|
|
return (
|
|
<Terminal
|
|
autoScroll={true}
|
|
isStreaming={isStreaming}
|
|
onClear={handleClear}
|
|
output={output}
|
|
>
|
|
<TerminalHeader>
|
|
<TerminalTitle>Build Output</TerminalTitle>
|
|
<div className="flex items-center gap-1">
|
|
<TerminalStatus />
|
|
<TerminalActions>
|
|
<TerminalCopyButton onCopy={handleTerminalCopy} />
|
|
<TerminalClearButton />
|
|
</TerminalActions>
|
|
</div>
|
|
</TerminalHeader>
|
|
<TerminalContent />
|
|
</Terminal>
|
|
);
|
|
};
|
|
|
|
export default Example;
|