Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
| **权限系统** | 危险操作前请求许可 |
| **YOLO 模式** | 使用 `--yolo` 跳过所有提示(类似 Claude Code) |
| **对话历史** | 跨会话保存 |
| **多行输入** | 按 Ctrl+J 插入换行 |

</details>

Expand All @@ -74,6 +75,7 @@
| **Permission System** | Asks before dangerous operations |
| **YOLO Mode** | Skip all prompts with `--yolo` (like Claude Code) |
| **Conversation History** | Persists across sessions |
| **Multiline Input** | Press Ctrl+J to insert newlines |

</details>

Expand Down
20 changes: 18 additions & 2 deletions deepseek_code/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from dotenv import load_dotenv
from prompt_toolkit import PromptSession
from prompt_toolkit.history import FileHistory
from prompt_toolkit.key_binding import KeyBindings
from rich.console import Console

from . import __version__
Expand All @@ -30,12 +31,26 @@


def get_prompt_session() -> PromptSession:
"""Create a prompt session with history."""
"""Create a prompt session with history and multiline support."""
history_dir = os.path.expanduser("~/.deepseek-code")
os.makedirs(history_dir, exist_ok=True)
history_file = os.path.join(history_dir, "prompt_history")

return PromptSession(history=FileHistory(history_file))
bindings = KeyBindings()

@bindings.add("enter")
def _(event):
event.current_buffer.validate_and_handle()

@bindings.add("c-j")
def _(event):
event.current_buffer.insert_text("\n")

return PromptSession(
history=FileHistory(history_file),
key_bindings=bindings,
multiline=True,
)


def interactive_loop(agent: Agent) -> None:
Expand Down Expand Up @@ -120,6 +135,7 @@ def print_help(agent: Agent) -> None:
/status - Show current mode status

[bold]Tips:[/bold]
- Ctrl+J inserts a newline (for multiline input)
- Ask the AI to read files before editing them
- Use 'always' when prompted to auto-approve similar operations
- Create a DEEPSEEK.md file in your project root for project-specific context
Expand Down