Skip to content

feat: add AI-powered cluster naming with fallback to TF-IDF - #35

Merged
Harsh16gupta merged 3 commits into
masterfrom
feat/ai-cluster-naming
Jul 28, 2026
Merged

feat: add AI-powered cluster naming with fallback to TF-IDF#35
Harsh16gupta merged 3 commits into
masterfrom
feat/ai-cluster-naming

Conversation

@Harsh16gupta

Copy link
Copy Markdown
Collaborator

This PR adds cluster naming using Joplin's native AI chat API (joplin.ai.chat()).

Changes

  • Added aiNamingService.ts to format prompts, parse JSON responses, and sanitize category names.
  • Integrated AI naming into runPipeline.ts right after TF-IDF tag extraction (runs for both native embeddings and local ONNX worker paths).
  • Extended src/types/joplinAi.d.ts type declarations to include ChatMessage, ChatResult, and chat().
  • Added unit tests in test/pipeline/clustering/aiNamingService.test.ts.

Fallback Behavior

  • If AI is disabled, unconfigured, times out (>45s), or returns an invalid response, the pipeline falls back to existing TF-IDF names.
  • postProcess.ts and clusterNaming.ts remain untouched.

Testing
image

naming after using ai chat api
image

@Harsh16gupta Harsh16gupta self-assigned this Jul 25, 2026
@Harsh16gupta
Harsh16gupta requested a review from HahaBill July 25, 2026 23:19
@Harsh16gupta

Copy link
Copy Markdown
Collaborator Author

Regarding Provider Support:

joplin.ai.chat() routes through whatever provider the user has configured in Joplin's AI settings:

  • Local models via Ollama, LM Studio, or LocalAI
  • OpenAI-compatible APIs like DeepSeek, OpenAI, or Groq
  • Joplin Cloud AI and Anthropic (Claude)

The pr does not hardcode any provider or API key; it uses whichever model the user has active in Joplin Desktop.

I have tested it with deepseek, @HahaBill do you want me to test with other providers?

@Harsh16gupta

Copy link
Copy Markdown
Collaborator Author

I have tested it with deepseek, @HahaBill do you want me to test with other providers?

I also tested it with gemini and grok api keys and it works perfectly
also the whole pr is well scoped and well tested by me so I am merging it.

feat: optimize native Joplin AI embedding pipeline and clustering quality
@Harsh16gupta
Harsh16gupta merged commit 9c47b78 into master Jul 28, 2026
2 checks passed
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