mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-04 04:57:51 +00:00 
			
		
		
		
	- This PR adds a UI to validate the response source quality quickly. It also helps to test with sample questions and update responses in the database when missing. Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
		
			
				
	
	
		
			29 lines
		
	
	
		
			804 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			804 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
import 'chart.js';
 | 
						|
import Vue from 'vue';
 | 
						|
import VueDOMPurifyHTML from 'vue-dompurify-html';
 | 
						|
Vue.use(VueDOMPurifyHTML);
 | 
						|
 | 
						|
const PlaygroundIndex = () =>
 | 
						|
  import('../superadmin_pages/views/playground/Index.vue');
 | 
						|
 | 
						|
const ComponentMapping = {
 | 
						|
  PlaygroundIndex: PlaygroundIndex,
 | 
						|
};
 | 
						|
 | 
						|
const renderComponent = (componentName, props) => {
 | 
						|
  Vue.component(componentName, ComponentMapping[componentName]);
 | 
						|
  new Vue({
 | 
						|
    data: { props: props },
 | 
						|
    template: `<${componentName} :component-data="props"/>`,
 | 
						|
  }).$mount('#app');
 | 
						|
};
 | 
						|
 | 
						|
document.addEventListener('DOMContentLoaded', () => {
 | 
						|
  const element = document.getElementById('app');
 | 
						|
  if (element) {
 | 
						|
    const componentName = element.dataset.componentName;
 | 
						|
    const props = JSON.parse(element.dataset.props);
 | 
						|
    renderComponent(componentName, props);
 | 
						|
  }
 | 
						|
});
 |