rewrote welcome_new article; updated readme file; introduced /help command.

This commit is contained in:
Xiaohan-Tian
2025-08-21 23:05:22 -07:00
parent 0c54332401
commit f2355b2350
6 changed files with 184 additions and 67 deletions
+28 -1
View File
@@ -82,9 +82,36 @@ export async function processUserMessage(originalMessage: string): Promise<UserM
}
}
case '/help': {
try {
const url = `${import.meta.env.BASE_URL}chat/help.md`;
const resp = await fetch(url);
if (!resp.ok) {
throw new Error(`Failed to fetch ${url}: ${resp.status}`);
}
const md = await resp.text();
return {
displayUserMessage: false,
sendToLLM: false,
finalMessageForLLM: null,
pseudoAssistantResponse: md,
metadata: { command: 'help' }
};
} catch (err) {
const fallback = 'Help is currently unavailable.';
return {
displayUserMessage: false,
sendToLLM: false,
finalMessageForLLM: null,
pseudoAssistantResponse: fallback,
metadata: { command: 'help', error: String(err) }
};
}
}
default: {
const { setStatus } = useProjectStore.getState();
const help = 'Available commands: /clear, /welcome';
const help = 'Available commands: /clear, /welcome, /help';
setStatus(`Unknown command: ${command}. ${help}`);
return {
displayUserMessage: false,
+1 -1
View File
@@ -62,7 +62,7 @@ export const wrapXmlBlocksInContent = (content: string): string => {
if (!xmlBlocks || xmlBlocks.length === 0) return content;
let result = content;
for (const block of xmlBlocks) {
const fenced = '```\n' + block + '\n```';
const fenced = '```xml\n' + block + '\n```';
result = result.split(block).join(fenced);
}
return result;