mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-04 13:07:55 +00:00 
			
		
		
		
	- Set up stores for copilotThreads and copilotMessages. - Add support for upsert messages to the copilotMessages store on receiving ActionCable events. - Implement support for the upsert option.
		
			
				
	
	
		
			19 lines
		
	
	
		
			427 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
		
			427 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
/* global axios */
 | 
						|
import ApiClient from '../ApiClient';
 | 
						|
 | 
						|
class CopilotMessages extends ApiClient {
 | 
						|
  constructor() {
 | 
						|
    super('captain/copilot_threads', { accountScoped: true });
 | 
						|
  }
 | 
						|
 | 
						|
  get(threadId) {
 | 
						|
    return axios.get(`${this.url}/${threadId}/copilot_messages`);
 | 
						|
  }
 | 
						|
 | 
						|
  create({ threadId, ...rest }) {
 | 
						|
    return axios.post(`${this.url}/${threadId}/copilot_messages`, rest);
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
export default new CopilotMessages();
 |