Skip to content

chat Command

Interactive chat with MyDeskBot.

Usage

bash
mydeskbot chat [options]

Options

OptionAliasDescriptionDefault
--model-mAI model to useConfigured model
--temperature-tTemperature (0.0-2.0)1.0
--max-tokens-nMax response tokens4096
--system-sSystem prompt-
--history-HLoad conversation history-
--saveSave conversation to file-
--no-colorDisable colored outputfalse
--help-hShow help-

Interactive Commands

Once in chat mode, use these commands:

CommandDescription
/helpShow help
/clearClear conversation history
/historyShow conversation history
/model <name>Change model
/temperature <value>Set temperature
/save <file>Save conversation
/load <file>Load conversation
/exit or /quit or Ctrl+DExit chat
/code <file>Include code file in context

Examples

Start Chat

bash
mydeskbot chat

With Custom Model

bash
mydeskbot chat --model gpt-4

With System Prompt

bash
mydeskbot chat --system "You are a Python expert"

Save Conversation

bash
mydeskbot chat --save conversation.json

Load Conversation History

bash
mydeskbot chat --history conversation.json

Session Example

bash
$ mydeskbot chat

> Hello! I'm MyDeskBot CLI. How can I help you today?

You: How do I create a REST API with Node.js and Express?

MyDeskBot: Here's how to create a REST API with Node.js and Express:

1. Initialize project:
   npm init -y
   npm install express

2. Create server.js:
   const express = require('express');
   const app = express();
   app.use(express.json());

   app.get('/api/users', (req, res) => {
     res.json({ users: [] });
   });

   app.listen(3000, () => {
     console.log('Server running on port 3000');
   });

3. Run server:
   node server.js

Would you like me to explain any part in more detail?

You: Add authentication

MyDeskBot: Here's how to add JWT authentication:

[...]

You: /save my-chat.json
Conversation saved to my-chat.json

You: /exit
Goodbye!

Use Cases

1. Code Assistance

You: Help me debug this error

[Show error]

MyDeskBot: The error indicates...

2. Learning

You: Explain how promises work in JavaScript

MyDeskBot: Promises in JavaScript are...

3. Brainstorming

You: Give me ideas for a mobile app

MyDeskBot: Here are some mobile app ideas...

4. Code Review

You: Review this code

[Show code]

MyDeskBot: Here's my review...

5. Problem Solving

You: I have a slow API, how can I optimize it?

MyDeskBot: Here are optimization strategies...

Context Management

Include Code Files

You: /code src/utils/helper.js
File included: src/utils/helper.js

You: Add error handling to this function

MyDeskBot: Here's the function with error handling...

Clear Context

You: /clear
Conversation history cleared.

View History

You: /history

Conversation History:
====================
1. You: How do I create a REST API?
   Bot: [Response]

2. You: Add authentication
   Bot: [Response]

Configuration in Chat

Change Model

You: /model gpt-4
Model changed to gpt-4

Set Temperature

You: /temperature 0.5
Temperature set to 0.5

Saving and Loading

Save Conversation

You: /save my-conversation.json
Saved to my-conversation.json

Load Conversation

bash
# From command line
mydeskbot chat --history my-conversation.json

# Or in chat
You: /load my-conversation.json
Loaded my-conversation.json

Tips

1. Be Clear and Specific

Good: "How do I implement pagination in a PostgreSQL query?"
Less clear: "How to paginate?"

2. Provide Context

You: I'm building a React app with TypeScript and need to handle forms

MyDeskBot: Here's how to handle forms in React with TypeScript...

3. Follow Up

You: Create a REST API
[Response]

You: Add authentication
[Response]

You: Add rate limiting
[Response]

4. Save Useful Conversations

You: /save api-tutorial.json
Saved to api-tutorial.json

Advanced Features

Multi-turn Conversations

You: What is React?
MyDeskBot: React is...

You: How is it different from Vue?
MyDeskBot: React differs from Vue in...

You: Which one should I choose?
MyDeskBot: The choice depends on...

Code Exploration

You: /code src/
Multiple files in src/:
- src/App.js
- src/utils/helper.js
- src/components/Header.js

Which file would you like to include?

System Prompts

bash
mydeskbot chat --system "You are a senior Python developer. Always provide production-ready code with error handling and documentation."

Keyboard Shortcuts

ShortcutAction
Ctrl+CCancel current request
Ctrl+DExit chat
Ctrl+LClear screen
Up ArrowPrevious message
Down ArrowNext message
TabAutocomplete commands

Troubleshooting

Chat Not Responding

Problem: No response from AI

Solutions:

  1. Check API key is configured
  2. Check internet connection
  3. Try a different model
  4. Check API quota

History Not Saving

Problem: Conversation history lost

Solutions:

  1. Use /save command before exiting
  2. Check file permissions
  3. Use --save option when starting

Code Not Found

Problem: /code command can't find file

Solutions:

  1. Use absolute or relative path
  2. Check file exists
  3. Use correct file extension

See Also