Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

style: remove placeholder animation

Brad Barbincb3734994312
diff --git a/apps/erp/app/components/Chat/ChatInput.tsx b/apps/erp/app/components/Chat/ChatInput.tsx
index 5cf29789f1..51746e037b 100644
--- a/apps/erp/app/components/Chat/ChatInput.tsx
+++ b/apps/erp/app/components/Chat/ChatInput.tsx
@@ -1,9 +1,8 @@
import { useArtifacts } from "@ai-sdk-tools/artifacts/client";
import { useChatActions, useChatId, useChatStatus } from "@ai-sdk-tools/store";
import { cn } from "@carbon/react";
-import { forwardRef, useEffect, useRef, useState } from "react";
+import { forwardRef, useRef } from "react";
import { CommandMenu } from "./CommandMenu";
-import { useChatInterface } from "./hooks/useChatInterface";
import { useChatStore } from "./lib/store";
import {
PromptInput,
@@ -33,22 +32,9 @@ interface ChatInputProps {
hasMessages: boolean;
}
-const placeholderTexts = [
- "Create a purchase order for 5 boxes of rubber gloves",
- "Get the status of the SpaceX order",
- 'Create a quality issue for 1/4" steel from Alro',
- "Generate a quote for 1000 widgets",
- "What is John Doe working on today?",
- "How much money are we owed right now?",
-];
-
export const ChatInput = forwardRef<RecordButtonRef, ChatInputProps>(
function ChatInput({ hasMessages }, ref) {
const textareaRef = useRef<HTMLTextAreaElement>(null);
- const [currentPlaceholder, setCurrentPlaceholder] = useState("");
- const [currentTextIndex, setCurrentTextIndex] = useState(0);
- const [currentCharIndex, setCurrentCharIndex] = useState(0);
- const [isTyping, setIsTyping] = useState(true);
const status = useChatStatus();
const { sendMessage, stop } = useChatActions();
@@ -59,8 +45,6 @@ export const ChatInput = forwardRef<RecordButtonRef, ChatInputProps>(
});
const isCanvasVisible = !!current;
- const { isChatPage } = useChatInterface();
-
const {
input,
isWebSearch,
@@ -76,53 +60,6 @@ export const ChatInput = forwardRef<RecordButtonRef, ChatInputProps>(
resetCommandState,
} = useChatStore();
- // Animated placeholder effect
- useEffect(() => {
- if (!isChatPage) {
- setCurrentPlaceholder("");
- return;
- }
-
- if (isWebSearch || isRecording || hasMessages) {
- setCurrentPlaceholder("Ask anything");
- return;
- }
-
- const currentText = placeholderTexts[currentTextIndex];
-
- const typeText = () => {
- if (isTyping) {
- if (currentCharIndex < currentText.length) {
- setCurrentPlaceholder(currentText.slice(0, currentCharIndex + 1));
- setCurrentCharIndex((prev) => prev + 1);
- } else {
- // Finished typing, wait then start erasing
- setTimeout(() => setIsTyping(false), 1000);
- }
- } else {
- if (currentCharIndex > 0) {
- setCurrentPlaceholder(currentText.slice(0, currentCharIndex - 1));
- setCurrentCharIndex((prev) => prev - 1);
- } else {
- // Finished erasing, move to next text
- setCurrentTextIndex((prev) => (prev + 1) % placeholderTexts.length);
- setIsTyping(true);
- }
- }
- };
-
- const timeout = setTimeout(typeText, isTyping ? 50 : 25);
- return () => clearTimeout(timeout);
- }, [
- currentCharIndex,
- currentTextIndex,
- isTyping,
- isWebSearch,
- isRecording,
- hasMessages,
- isChatPage,
- ]);
-
const handleSubmit = (message: ChatInputMessage) => {
// If currently streaming or submitted, stop instead of submitting
if (status === "streaming" || status === "submitted") {
@@ -222,9 +159,7 @@ export const ChatInput = forwardRef<RecordButtonRef, ChatInputProps>(
handleKeyDown(e);
}}
value={input}
- placeholder={
- isWebSearch ? "Search the web" : currentPlaceholder
- }
+ placeholder={isWebSearch ? "Search the web" : "Ask anything"}
/>
</PromptInputBody>
<PromptInputToolbar>
diff --git a/apps/erp/app/routes/api+/ai+/chat+/agents/purchasing-agent.ts b/apps/erp/app/routes/api+/ai+/chat+/agents/purchasing-agent.ts
index b92a7c5ed9..93a236aedf 100644
--- a/apps/erp/app/routes/api+/ai+/chat+/agents/purchasing-agent.ts
+++ b/apps/erp/app/routes/api+/ai+/chat+/agents/purchasing-agent.ts
@@ -20,7 +20,7 @@ export const purchasingAgent = createAgent({
temperature: 0.3,
instructions: (ctx) => `You are a purchasing specialist for ${
ctx.companyName
- }. Create purchase orders or get quotes from suppliers.
+ }. Create purchase orders or get quotes from suppliers. Keep in mind that we have readable IDs and the actual IDs are not always the same.
When handling purchase order requests:
1. First identify the part details (including quantities and measurements)
@@ -43,6 +43,7 @@ For example:
2. Look up supplier ID for "MetalCorp"
3. Create the PO with both IDs
+
Key capabilities:
- Create and update purchase orders
- Search for suppliers and parts
diff --git a/apps/erp/app/routes/api+/ai+/chat+/tools/create-purchase-order.ts b/apps/erp/app/routes/api+/ai+/chat+/tools/create-purchase-order.ts
index 64d0762e3a..0a69e8691d 100644
--- a/apps/erp/app/routes/api+/ai+/chat+/tools/create-purchase-order.ts
+++ b/apps/erp/app/routes/api+/ai+/chat+/tools/create-purchase-order.ts
@@ -189,7 +189,7 @@ export const createPurchaseOrderTool = tool({
]);
if (!item.data) {
- throw new Error(`Item not found: ${part.partId}`);
+ throw new Error(`Item with ID ${part.partId} not found`);
}
// Get item cost and replenishment info