Add embedded AI support #110

Closed
opened 2026-04-26 07:54:20 +00:00 by jabber.developer · 0 comments

Motivation

CProof users want AI-assisted responses without leaving the chat client. This feature enables users to query AI models directly from within CProof — for quick answers, message drafting, or knowledge retrieval.

Privacy First

  • No telemetry: No data is sent to CProof or any third party except the configured AI provider
  • Local-first: Any OpenAI-compatible API endpoint works, including local servers (Ollama, LM Studio, vLLM)
  • User-controlled keys: API keys are stored per-provider in the preferences file, never hardcoded
  • No account required: No CProof account, no sign-up, no tracking

Proposed Feature

Add an AI client module to CProof that lets users interact with AI providers from within the chat interface.

User Experience

A user should be able to:

  1. Start an AI session with /ai start
  2. See a dedicated AI window open for the conversation
  3. Send messages and receive AI responses
  4. Switch between providers and models
  5. Use tab-completion for provider names (/ai s<tab>)
  6. Have providers and API keys persist across CProof sessions

Acceptance Criteria

Core Functionality

  • AC-1: Running /ai start opens a dedicated AI conversation window
  • AC-2: The AI window displays the user's prompt and the AI's response
  • AC-3: AI responses are properly formatted, including multiline responses (no garbled text, proper line breaks preserved)
  • AC-4: The conversation maintains history within a session (the AI sees previous messages in the conversation)
  • AC-5: Running /ai stop closes the AI window and ends the session

Provider Management

  • AC-6: Default providers are available out of the box (OpenAI, Perplexity)
  • AC-7: Users can add custom providers with /ai provider add <name> <url>
  • AC-8: Users can list available providers with /ai provider list
  • AC-9: Users can switch providers mid-conversation

API Key Management

  • AC-10: Users can set an API key for a provider with /ai key <provider> <key>
  • AC-11: API keys persist across CProof sessions (saved to preferences file)
  • AC-12: API keys are not displayed in plain text when listed

Autocomplete

  • AC-13: /ai s<tab> autocompletes to available providers (e.g., openai, perplexity)
  • AC-14: /ai s<tab><tab> cycles through all provider names
  • AC-15: Autocomplete works for custom providers added by the user

Error Handling

  • AC-16: If the API key is invalid, the user sees a clear error message
  • AC-17: If the provider is unreachable, the user sees a clear error message
  • AC-18: If the AI returns an error, it is displayed in the AI window

Local/Custom Servers

  • AC-19: Users can configure a local OpenAI-compatible server (e.g., Ollama at http://localhost:11434)
  • AC-20: Custom endpoints work identically to public APIs

Commands Reference

Command Description
/ai start <provider> [model] Open a new AI conversation window
/ai stop Close the current AI window and end the session
/ai message <text> Send a message to the current AI session
/ai provider add <name> <url> Add a custom AI provider
/ai provider list List all configured providers
/ai provider remove <name> Remove a custom provider
/ai key <provider> <key> Set the API key for a provider
/ai model <model> Switch the model for the current session
/ai history clear Clear the conversation history

Example Workflow

# Start a conversation with OpenAI's GPT-4
/cproof $ /ai start openai gpt-4
[AI Window opens]

# Send a message
/cproof $ What is the capital of France?
[AI Window displays: "The capital of France is Paris."]

# Add a local Ollama instance
/cproof $ /ai provider add ollama http://localhost:11434/v1
/cproof $ /ai key ollama ollama-local-key
/cproof $ /ai start ollama llama3.1
[AI Window opens with local Ollama]
## Motivation CProof users want AI-assisted responses without leaving the chat client. This feature enables users to query AI models directly from within CProof — for quick answers, message drafting, or knowledge retrieval. ### Privacy First - **No telemetry**: No data is sent to CProof or any third party except the configured AI provider - **Local-first**: Any OpenAI-compatible API endpoint works, including local servers (Ollama, LM Studio, vLLM) - **User-controlled keys**: API keys are stored per-provider in the preferences file, never hardcoded - **No account required**: No CProof account, no sign-up, no tracking ## Proposed Feature Add an AI client module to CProof that lets users interact with AI providers from within the chat interface. ### User Experience A user should be able to: 1. Start an AI session with `/ai start` 2. See a dedicated AI window open for the conversation 3. Send messages and receive AI responses 4. Switch between providers and models 5. Use tab-completion for provider names (`/ai s<tab>`) 6. Have providers and API keys persist across CProof sessions ### Acceptance Criteria #### Core Functionality - [ ] **AC-1**: Running `/ai start` opens a dedicated AI conversation window - [ ] **AC-2**: The AI window displays the user's prompt and the AI's response - [ ] **AC-3**: AI responses are properly formatted, including multiline responses (no garbled text, proper line breaks preserved) - [ ] **AC-4**: The conversation maintains history within a session (the AI sees previous messages in the conversation) - [ ] **AC-5**: Running `/ai stop` closes the AI window and ends the session #### Provider Management - [ ] **AC-6**: Default providers are available out of the box (OpenAI, Perplexity) - [ ] **AC-7**: Users can add custom providers with `/ai provider add <name> <url>` - [ ] **AC-8**: Users can list available providers with `/ai provider list` - [ ] **AC-9**: Users can switch providers mid-conversation #### API Key Management - [ ] **AC-10**: Users can set an API key for a provider with `/ai key <provider> <key>` - [ ] **AC-11**: API keys persist across CProof sessions (saved to preferences file) - [ ] **AC-12**: API keys are not displayed in plain text when listed #### Autocomplete - [ ] **AC-13**: `/ai s<tab>` autocompletes to available providers (e.g., `openai`, `perplexity`) - [ ] **AC-14**: `/ai s<tab><tab>` cycles through all provider names - [ ] **AC-15**: Autocomplete works for custom providers added by the user #### Error Handling - [ ] **AC-16**: If the API key is invalid, the user sees a clear error message - [ ] **AC-17**: If the provider is unreachable, the user sees a clear error message - [ ] **AC-18**: If the AI returns an error, it is displayed in the AI window #### Local/Custom Servers - [ ] **AC-19**: Users can configure a local OpenAI-compatible server (e.g., Ollama at `http://localhost:11434`) - [ ] **AC-20**: Custom endpoints work identically to public APIs ## Commands Reference | Command | Description | |---|---| | `/ai start <provider> [model]` | Open a new AI conversation window | | `/ai stop` | Close the current AI window and end the session | | `/ai message <text>` | Send a message to the current AI session | | `/ai provider add <name> <url>` | Add a custom AI provider | | `/ai provider list` | List all configured providers | | `/ai provider remove <name>` | Remove a custom provider | | `/ai key <provider> <key>` | Set the API key for a provider | | `/ai model <model>` | Switch the model for the current session | | `/ai history clear` | Clear the conversation history | ## Example Workflow ``` # Start a conversation with OpenAI's GPT-4 /cproof $ /ai start openai gpt-4 [AI Window opens] # Send a message /cproof $ What is the capital of France? [AI Window displays: "The capital of France is Paris."] # Add a local Ollama instance /cproof $ /ai provider add ollama http://localhost:11434/v1 /cproof $ /ai key ollama ollama-local-key /cproof $ /ai start ollama llama3.1 [AI Window opens with local Ollama] ```
jabber.developer added the
Kind/Feature
Priority
High
2
Reviewed
Confirmed
1
labels 2026-04-26 07:59:20 +00:00
jabber.developer added this to the Plans (2025-2026) project 2026-04-26 07:59:29 +00:00
jabber.developer moved this to In Progress in Plans (2025-2026) on 2026-05-05 10:50:27 +00:00
jabber.developer moved this to Done in Plans (2025-2026) on 2026-05-15 02:23:10 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: devs/cproof#110
No description provided.