rewrote welcome_new article; updated readme file; introduced /help command.
This commit is contained in:
@@ -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
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user