mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-17 07:03:25 +00:00
feat(tui): Add instructional header and welcome message to chat demo
- Add header with slash command and file autocomplete instructions - Add initial welcome message with detailed feature descriptions - Import TextComponent for the header - Make it clearer how to use all the demo features
This commit is contained in:
parent
5ceaa91c74
commit
2ec8a27222
1 changed files with 26 additions and 1 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env npx tsx
|
#!/usr/bin/env npx tsx
|
||||||
import { TUI, Container, TextEditor, MarkdownComponent, CombinedAutocompleteProvider } from "../src/index.js";
|
import { TUI, Container, TextEditor, TextComponent, MarkdownComponent, CombinedAutocompleteProvider } from "../src/index.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Chat Application with Autocomplete
|
* Chat Application with Autocomplete
|
||||||
|
|
@ -12,6 +12,13 @@ import { TUI, Container, TextEditor, MarkdownComponent, CombinedAutocompleteProv
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const ui = new TUI();
|
const ui = new TUI();
|
||||||
|
|
||||||
|
// Add header with instructions
|
||||||
|
const header = new TextComponent(
|
||||||
|
"💬 Chat Demo | Type '/' for commands | Start typing a filename + Tab to autocomplete | Ctrl+C to exit",
|
||||||
|
{ bottom: 1 }
|
||||||
|
);
|
||||||
|
|
||||||
const chatHistory = new Container();
|
const chatHistory = new Container();
|
||||||
const editor = new TextEditor();
|
const editor = new TextEditor();
|
||||||
|
|
||||||
|
|
@ -74,6 +81,24 @@ ui.onGlobalKeyPress = (data: string) => {
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Add initial welcome message to chat history
|
||||||
|
chatHistory.addChild(new MarkdownComponent(`
|
||||||
|
## Welcome to the Chat Demo!
|
||||||
|
|
||||||
|
**Available slash commands:**
|
||||||
|
- \`/clear\` - Clear the chat history
|
||||||
|
- \`/help\` - Show help information
|
||||||
|
- \`/attach <file>\` - Attach a file (with autocomplete)
|
||||||
|
|
||||||
|
**File autocomplete:**
|
||||||
|
- Start typing any filename or directory name and press **Tab**
|
||||||
|
- Works with relative paths (\`./\`, \`../\`)
|
||||||
|
- Works with home directory (\`~/\`)
|
||||||
|
|
||||||
|
Try it out! Type a message or command below.
|
||||||
|
`));
|
||||||
|
|
||||||
|
ui.addChild(header);
|
||||||
ui.addChild(chatHistory);
|
ui.addChild(chatHistory);
|
||||||
ui.addChild(editor);
|
ui.addChild(editor);
|
||||||
ui.setFocus(editor);
|
ui.setFocus(editor);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue