Commit Graph
5652 Commits
Author SHA1 Message Date
Shivam Mishra 89c7feeda7 feat: simplify make api call 2025-12-17 17:37:35 +05:30
Shivam Mishra 9527059b54 feat: simplify message generator 2025-12-17 17:28:10 +05:30
Shivam Mishra 79ff1b58eb refactor: common conversation messages 2025-12-17 17:19:16 +05:30
Shivam Mishra 6d65f2dcf0 fix: payload keys access 2025-12-17 17:12:45 +05:30
Shivam Mishra 61f01ebc2e refactor: label suggestion service 2025-12-17 17:12:33 +05:30
Shivam Mishra a65861ada6 refactor: get rid of unnecessary serialization and deserialization 2025-12-17 17:06:03 +05:30
Shivam Mishra 5b02b8e7c8 feat: split editor actions to multiple services 2025-12-17 16:58:31 +05:30
Shivam Mishra 2f81fcee8c feat: use new service 2025-12-17 16:57:32 +05:30
Shivam Mishra ffc621b6e6 feat: remove old processor service 2025-12-17 16:38:41 +05:30
Shivam Mishra c86db87161 feat: add label suggestions, reply suggestion and summary 2025-12-17 16:38:23 +05:30
Shivam Mishra c7bfc64480 fix: editor.js events 2025-12-17 15:39:45 +05:30
Shivam Mishra b4bd5634a1 feat: use new controller 2025-12-16 17:14:01 +05:30
Shivam Mishra db7c7f5edf feat: editor controller 2025-12-16 17:13:55 +05:30
Shivam Mishra 5a38a63312 feat: separate service for editor tasks 2025-12-16 17:13:13 +05:30
Shivam Mishra 04831aec00 chore: update improve prompt 2025-12-16 15:45:37 +05:30
56ab3fc6b8 chore: apply suggestions
Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
2025-12-16 15:44:38 +05:30
Shivam Mishra eaa34e7430 feat: use icon component for loader 2025-12-16 15:43:33 +05:30
iamsivin 4888d789bf chore: Show copilot icon in private note menubar 2025-12-16 15:06:36 +05:30
Shivam Mishra dd39b3952c fix: events 2025-12-16 14:42:53 +05:30
Shivam Mishra b3700c0670 feat: remove unused constant 2025-12-16 14:41:21 +05:30
Shivam Mishra 75c92807cf test: update processor service specs for liquid templates
- Update system instruction expectations to match new liquid template format
- Fix event names: make_friendly -> friendly, remove make_formal
- All specs now pass with the refactored liquid-based implementation
2025-12-16 14:39:46 +05:30
Shivam Mishra 8b9ce74845 chore: remove unused imports 2025-12-16 14:29:12 +05:30
Shivam Mishra 540a1d2244 feat: add captain loader 2025-12-16 14:28:53 +05:30
Shivam Mishra d464284394 chore: add todo comment 2025-12-16 13:47:07 +05:30
Shivam Mishra 8b3f28753a feat: add improve service 2025-12-16 13:46:54 +05:30
Shivam Mishra 50b45170e7 feat: include improve 2025-12-16 13:44:13 +05:30
Shivam Mishra e8d1abf541 refactor: rename to liquid 2025-12-16 13:35:36 +05:30
Shivam Mishra d5fccf084a refactor: call llm method 2025-12-16 13:32:35 +05:30
Shivam Mishra c8a6ef12f3 refactor: use liquid 2025-12-16 13:29:04 +05:30
Shivam Mishra fb91dd3ab3 feat: add improve.txt 2025-12-16 13:24:36 +05:30
Shivam Mishra 52062eba20 feat: enable improve option 2025-12-16 13:24:24 +05:30
Shivam Mishra 8716d38f22 feat: better grammar fix prompt 2025-12-15 20:18:41 +05:30
Shivam Mishra 1f1c700e1e feat: show summarize only for private note 2025-12-15 20:10:01 +05:30
Shivam Mishra ba3e647ebe feat: disable improve 2025-12-15 20:08:04 +05:30
Shivam Mishra 6fc0c5d777 fix: key conflicts and event names 2025-12-15 20:05:14 +05:30
Shivam Mishra fbc0ff7509 fix: issues from conflicts 2025-12-15 20:00:10 +05:30
Shivam MishraandGitHub 907eb5c4bb Merge branch 'feat/captain-editor-integration' into feat/CW-5648 2025-12-15 18:47:10 +05:30
0fe2bf8647 feat: Rewrite APIs for ai editor message improvement (#13059)
Co-authored-by: Vishnu Narayanan <iamwishnu@gmail.com>
2025-12-15 18:38:21 +05:30
3fce56c98f fix: captain template message conflict (#13048)
Co-authored-by: aakashb95 <aakash@chatwoot.com>
Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
Co-authored-by: Vishnu Narayanan <iamwishnu@gmail.com>
2025-12-15 15:47:26 +05:30
Vishnu NarayananandGitHub 26b4a24f11 fix: linear and user association spec (#13056)
- Linear::CallbacksController: Replace broken
`described_class.new`mocking with proper `GlobalConfigService` stubbing
and real JWT token generation. The old pattern doesn't work in request
specs since Rails instantiates controllers internally.
- User associations: Remove `.class_name('Conversation')` assertion that
fails intermittently due to enterprise `prepend_mod_with` timing in
parallel tests. The class_name is already enforced by Rails at runtime -
if wrong, the app would crash immediately. No need to explicitly test
for this

Fixes
https://linear.app/chatwoot/issue/CW-6138/debug-linear-and-user-spec-failures-in-ci
2025-12-12 18:53:26 +05:30
a8ed074bf0 fix: Preserve double newlines in text-based messaging channels (#13055)
## Summary

Fixes the issue where double newlines (paragraph breaks) were collapsing
to single newlines in text-based messaging channels (Telegram, WhatsApp,
Instagram, Facebook, LINE, SMS).

### Root Cause

The `preserve_multiple_newlines` method only preserved 3+ consecutive
newlines using the regex `/\n{3,}/`. When users pressed Enter twice
(creating a paragraph break with 2 newlines), CommonMarker would parse
this as separate paragraphs, which then collapsed to a single newline in
the output.

This caused:
-  Normal Enter: Double newlines collapsed to single newline
-  Shift+Enter: Worked (created hard breaks)

### Fix

Changed the regex from `/\n{3,}/` to `/\n{2,}/` to preserve 2+
consecutive newlines. This prevents CommonMarker from collapsing
paragraph breaks.

Now:
-  Single newline (`\n`) → Single newline (handled by softbreak)
-  Double newline (`\n\n`) → Double newline (preserved with
placeholders)
-  Triple+ newlines → Preserved as before

### Test Coverage

Added comprehensive tests for:
- Single newlines preservation
- Double newlines (paragraph breaks) preservation  
- Multiple consecutive newlines
- Newlines with varying amounts of whitespace between them (1 space, 3
spaces, 5 spaces, tabs)

All 66 tests passing.

### Impact

This fix affects all text-based messaging channels that use the markdown
renderer:
- Telegram
- WhatsApp
- Instagram  
- Facebook
- LINE
- SMS
- Twilio SMS (when configured for WhatsApp)

Fixes
https://linear.app/chatwoot/issue/CW-6135/double-newline-is-breaking

---------

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
2025-12-12 16:35:53 +05:30
Sivin VargheseandGitHub 96fe3e146d chore: Clean up reply box component (#13060) 2025-12-12 10:50:02 +05:30
Sivin VargheseandGitHub 696564863c feat: Add plain-text editor for non-rich content channels (#13058)
# Pull Request Template

## Description

This PR restores the plain text editor for all channels except Website,
Email, and API.

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)


## Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [ ] I have commented on my code, particularly in hard-to-understand
areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream
modules
2025-12-12 10:14:22 +05:30
df4c8cf58b chore: Strip unsupported signature formatting by channel (#13046)
# Pull Request Template

## Description

1. This PR is an enhancement to
https://github.com/chatwoot/chatwoot/pull/13045
It strips unsupported formatting from **message signatures** based on
each channel’s formatting capabilities defined in the `FORMATTING`
config

2. Remove usage of plain editor in Compose new conversation modal

Only the following signature elements are considered:
<strong>bold (<code inline="">strong</code>), italic (<code
inline="">em</code>), links (<code inline="">link</code>), images (<code
inline="">image</code>)</strong>.</p>

Any formatting not supported by the target channel is automatically
removed before the signature is appended.

<h3>Channel-wise Signature Formatting Support</h3>

Channel | Keeps in Signature | Strips from Signature
-- | -- | --
Email | bold, italic, links, images | —
WebWidget | bold, italic, links, images | —
API | bold, italic | links, images
WhatsApp | bold, italic | links, images
Telegram | bold, italic, links | images
Facebook | bold, italic | links, images
Instagram | bold, italic | links, images
Line | bold, italic | links, images
SMS | — | everything
Twilio SMS | — | everything
Twitter/X | — | everything


<hr>
<h3>📝 Note</h3>
<blockquote>
<p>Message signatures only support <strong>bold, italic, links, and
images</strong>.<br>
Other formatting options available in the editor (lists, code blocks,
strike-through, etc.) do <strong>not apply</strong> to signatures and
are ignored.</p>
</blockquote>

## Type of change

- [x] New feature (non-breaking change which adds functionality)

## How Has This Been Tested?

### Loom video
https://www.loom.com/share/d325ab86ca514c6d8f90dfe72a8928dd


## Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [x] I have commented on my code, particularly in hard-to-understand
areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream
modules

---------

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
2025-12-11 19:58:59 +05:30
Sivin VargheseandGitHub 9c2a889ebb Merge branch 'develop' into feat/CW-5648 2025-12-11 17:13:30 +05:30
2bd8e76886 feat: Add backend changes for whatsapp csat template (#12984)
This PR add the backend changes for the feature [sending CSAT surveys
via WhatsApp message templates
](https://github.com/chatwoot/chatwoot/pull/12787)

---------

Co-authored-by: Vinay Keerthi <11478411+stonecharioteer@users.noreply.github.com>
2025-12-11 16:36:37 +05:30
Aakash BakhleandGitHub 1de8d3e56d feat: legacy features to ruby llm (#12994) 2025-12-11 14:17:28 +05:30
Sivin VargheseandGitHub c6e282eeac Merge branch 'develop' into feat/CW-5648 2025-12-11 10:05:59 +05:30
Sivin VargheseandGitHub f2054e703a fix: Handle rich message signatures & attachment overflow (#13045) 2025-12-10 23:13:04 +05:30
Vinay KeerthiandGitHub 89d02e2c92 fix: Preserve multiple newlines with whitespace in text-based messaging channels (#13044)
## Description

Fixes an issue where multiple newlines with whitespace between them
(e.g., `\n \n \n`) were being collapsed to single newlines in text-based
messaging channels (Telegram, WhatsApp, Instagram, Facebook, Line, SMS).

The frontend was sending messages with spaces/tabs between newlines, and
the markdown renderer was treating these as paragraph content,
collapsing them during rendering.

### Changes:
1. Added whitespace normalization in `render_telegram_html`,
`render_whatsapp`, `render_instagram`, `render_line`, and
`render_plain_text` methods
2. Strips whitespace from whitespace-only lines before markdown
processing
3. Added comprehensive regression tests for all affected channels

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)

## How Has This Been Tested?

1. **Unit Tests**: Added 7 new specs testing multiple newlines with
whitespace between them for all text-based channels
2. **Manual Testing**: Verified with actual frontend payload containing
`\n \n \n` patterns
3. **Regression Testing**: All existing 63 specs pass

### Test Results:
-  All 63 markdown renderer specs pass (56 original + 7 new)
-  All 12 Telegram channel specs pass
-  All 27 WhatsApp + Instagram specs pass
-  Verified with real-world payload: 18 newlines preserved (previously
collapsed to 1)

### Test Command:
```bash
RAILS_ENV=test bundle exec rspec spec/services/messages/markdown_renderer_service_spec.rb
RAILS_ENV=test bundle exec rspec spec/models/channel/telegram_spec.rb
```

## Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective
- [x] New and existing unit tests pass locally with my changes
2025-12-10 21:44:16 +05:30