Skip to content

feat: Add OpenAI-Compatible API support and auto-rename on open#1

Open
hetiankong wants to merge 1 commit intodpshde:mainfrom
hetiankong:main
Open

feat: Add OpenAI-Compatible API support and auto-rename on open#1
hetiankong wants to merge 1 commit intodpshde:mainfrom
hetiankong:main

Conversation

@hetiankong
Copy link
Copy Markdown

Summary

This PR adds two major features to the Auto Title plugin:

1. OpenAI-Compatible API Support

  • Added a new provider option "OpenAI-Compatible" for custom OpenAI API-compatible services
  • New settings:
    • customBaseUrl: API base URL (default: https://api.xiaomimimo.com/v1)
    • customApiKey: API key for the custom provider
    • customModel: Model name (default: mimo-v2-flash)

2. Auto-Rename on Open

  • New setting to automatically generate titles when opening Untitled files
  • Configurable character threshold (default: 1000 characters)
  • Performance optimized with:
    • 2-second debounce to avoid frequent triggers
    • Processed files cache to prevent duplicate renaming
    • Lazy content reading

Changes

  • Modified src/settings.ts: Added new settings and 'custom' provider type
  • Modified src/api/openai.ts: Added isCustom parameter to support custom endpoints
  • Modified src/ui/settings-tab.ts: Added UI for new settings
  • Modified src/commands/title-generator.ts: Added checkThreshold parameter
  • Modified src/main.ts: Added customService and setupOpenTracking() method

Testing

  • Tested with xiaomimimo API endpoint
  • Verified auto-rename on open with various character thresholds
  • Confirmed no duplicate renaming when both features are enabled

- Add 'custom' provider for OpenAI-compatible APIs (e.g., xiaomimimo)
- Add customBaseUrl, customApiKey, customModel settings (default: mimo-v2-flash)
- Add auto-rename on open feature for Untitled files with threshold (default: 1000 chars)
- Implement debounce and caching for performance optimization
- Rename provider label from 'Custom OpenAI-compatible' to 'OpenAI-Compatible'

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant