fix: stronger no-tool system prompt + dev script starts tool-server
Some checks are pending
CI / build-check-test (push) Waiting to run
Some checks are pending
CI / build-check-test (push) Waiting to run
This commit is contained in:
parent
0caab5381c
commit
4c09f71351
2 changed files with 34 additions and 18 deletions
|
|
@ -4,7 +4,7 @@
|
|||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"dev": "concurrently \"vite\" \"node server/tool-server.mjs\"",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"check": "tsgo --noEmit",
|
||||
|
|
@ -14,7 +14,8 @@
|
|||
"dev:all": "concurrently \"npm run dev\" \"npm run dev:tools\"",
|
||||
"dev:tools": "node server/tool-server.mjs",
|
||||
"docker:build": "docker build -t jae-web .",
|
||||
"docker:run": "docker run -p 5173:5173 -p 7700:7700 -e OPENAI_API_KEY=$OPENAI_API_KEY jae-web"
|
||||
"docker:run": "docker run -p 5173:5173 -p 7700:7700 -e OPENAI_API_KEY=$OPENAI_API_KEY jae-web",
|
||||
"dev:vite": "vite"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jaeswift/jae-ai": "file:../../ai",
|
||||
|
|
|
|||
|
|
@ -22,7 +22,14 @@ import {
|
|||
import { html, render } from "lit";
|
||||
import { Brain, Download, History, Keyboard, Plus, Settings } from "lucide";
|
||||
import "./app.css";
|
||||
import { createImageGenTool, createMemoryTools, createTTSTool, createWebSearchTool, createBashTool, createBrowserTool } from "@jaeswift/jae-web-ui";
|
||||
import {
|
||||
createBashTool,
|
||||
createBrowserTool,
|
||||
createImageGenTool,
|
||||
createMemoryTools,
|
||||
createTTSTool,
|
||||
createWebSearchTool,
|
||||
} from "@jaeswift/jae-web-ui";
|
||||
import { icon } from "@mariozechner/mini-lit";
|
||||
import { Button } from "@mariozechner/mini-lit/dist/Button.js";
|
||||
import { Input } from "@mariozechner/mini-lit/dist/Input.js";
|
||||
|
|
@ -308,19 +315,21 @@ const createAgent = async (initialState?: Partial<AgentState>) => {
|
|||
if (agentUnsubscribe) agentUnsubscribe();
|
||||
agent = new Agent({
|
||||
initialState: initialState || {
|
||||
systemPrompt: `You are JAE, a friendly AI assistant and coding agent.
|
||||
systemPrompt: `You are JAE, a helpful AI coding assistant. Respond in plain text by default.
|
||||
|
||||
IMPORTANT RULES:
|
||||
- For casual conversation (greetings, questions, chat), just respond naturally in plain text. Do NOT use any tools for simple conversation.
|
||||
- Only use tools when the user explicitly asks you to do something that requires them:
|
||||
- Web Search: when user asks to look something up online
|
||||
- Image Generation: when user asks to create/generate an image
|
||||
- JavaScript REPL: when user asks to run code or create an interactive artifact
|
||||
- Text-to-Speech: when user asks to read something aloud
|
||||
- Memory: when user asks to remember or recall something
|
||||
- Artifacts: when user asks to create a file, document, or visual output
|
||||
- If the user just says "hi" or asks a question, respond conversationally WITHOUT calling any tools.
|
||||
- Be concise and helpful. Do not demonstrate tools unprompted.`,
|
||||
CRITICAL: Do NOT call any tools unless the user EXPLICITLY asks for something that requires a tool. Greetings, questions, casual chat, and general conversation require ZERO tools — just reply with plain text. Never create artifacts, files, or run code unless specifically requested.
|
||||
|
||||
Available tools (use ONLY when explicitly requested):
|
||||
- bash: Run shell commands
|
||||
- browser: Browse the web
|
||||
- web_search: Search the internet
|
||||
- image_gen: Generate images
|
||||
- javascript_repl: Run JS code or create HTML artifacts
|
||||
- tts: Text to speech
|
||||
- memory: Save/recall information
|
||||
|
||||
DO NOT use tools for: "hi", "hello", "how are you", "what is X", "explain Y", "testing", "test", or any general question.
|
||||
ONLY use tools for: "search for X", "run this code", "create a webpage", "generate an image of X", "open google.com", etc.`,
|
||||
model: getModel("venice", "llama-3.3-70b"),
|
||||
thinkingLevel: "off",
|
||||
messages: [],
|
||||
|
|
@ -351,9 +360,15 @@ IMPORTANT RULES:
|
|||
createTools: async (runtimeProvidersFactory: any) => {
|
||||
const replTool = createJavaScriptReplTool();
|
||||
replTool.runtimeProvidersFactory = runtimeProvidersFactory;
|
||||
return [replTool, createWebSearchTool(),
|
||||
return [
|
||||
replTool,
|
||||
createWebSearchTool(),
|
||||
createBashTool(),
|
||||
createBrowserTool(), createImageGenTool(), createTTSTool(), ...createMemoryTools()];
|
||||
createBrowserTool(),
|
||||
createImageGenTool(),
|
||||
createTTSTool(),
|
||||
...createMemoryTools(),
|
||||
];
|
||||
},
|
||||
});
|
||||
costTracker.bindAgent(agent);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue