- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.5k
[Components] chat_data #14041 #15260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            2 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      
    File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
        
          
          
            57 changes: 57 additions & 0 deletions
          
          57 
        
  components/chat_data/actions/create-chatbot/create-chatbot.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import app from "../../chat_data.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "chat_data-create-chatbot", | ||
| name: "Create Chatbot", | ||
| description: "Create a chatbot with the specified properties. [See the documentation](https://www.chat-data.com/api-reference#tag/Chatbot-Operations/operation/chatbotCreate)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| chatbotName: { | ||
| propDefinition: [ | ||
| app, | ||
| "chatbotName", | ||
| ], | ||
| }, | ||
| sourceText: { | ||
| propDefinition: [ | ||
| app, | ||
| "sourceText", | ||
| ], | ||
| }, | ||
| urlsToScrape: { | ||
| propDefinition: [ | ||
| app, | ||
| "urlsToScrape", | ||
| ], | ||
| }, | ||
| customBackend: { | ||
| propDefinition: [ | ||
| app, | ||
| "customBackend", | ||
| ], | ||
| }, | ||
| model: { | ||
| propDefinition: [ | ||
| app, | ||
| "model", | ||
| ], | ||
| }, | ||
| }, | ||
|  | ||
| async run({ $ }) { | ||
| const response = await this.app.createChatbot({ | ||
| $, | ||
| data: { | ||
| chatbotName: this.chatbotName, | ||
| sourceText: this.sourceText, | ||
| urlsToScrape: this.urlsToScrape, | ||
| customBackend: this.customBackend, | ||
| model: this.model, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully created Chatbot with ID '${response.chatbotId}'`); | ||
| return response; | ||
| }, | ||
| }; | ||
        
          
          
            29 changes: 29 additions & 0 deletions
          
          29 
        
  components/chat_data/actions/delete-chatbot/delete-chatbot.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import app from "../../chat_data.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "chat_data-delete-chatbot", | ||
| name: "Delete Chatbot", | ||
| description: "Delete a chatbot with the specified ID. [See the documentation](https://www.chat-data.com/api-reference#tag/Chatbot-Operations/operation/chatbotDelete)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| chatbotId: { | ||
| propDefinition: [ | ||
| app, | ||
| "chatbotId", | ||
| ], | ||
| }, | ||
| }, | ||
|  | ||
| async run({ $ }) { | ||
| const response = await this.app.deleteChatbot({ | ||
| $, | ||
| chatbotId: this.chatbotId, | ||
| }); | ||
|         
                  michelle0927 marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
|  | ||
| $.export("$summary", `Successfully deleted Chatbot with ID '${this.chatbotId}'`); | ||
|  | ||
| return response; | ||
| }, | ||
| }; | ||
        
          
          
            30 changes: 30 additions & 0 deletions
          
          30 
        
  components/chat_data/actions/get-chatbot-details/get-chatbot-details.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import app from "../../chat_data.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "chat_data-get-chatbot-details", | ||
|  | ||
| name: "Get Chatbot Status", | ||
| description: "Get status of the Chatbot with the specified ID. [See the documentation](https://www.chat-data.com/api-reference#tag/Chatbot-Operations/operation/GetChatbotStatus)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| chatbotId: { | ||
| propDefinition: [ | ||
| app, | ||
| "chatbotId", | ||
| ], | ||
| }, | ||
| }, | ||
|  | ||
| async run({ $ }) { | ||
| const response = await this.app.getChatbotStatus({ | ||
| $, | ||
| chatbotId: this.chatbotId, | ||
| }); | ||
|  | ||
| $.export("$summary", `Successfully retrieved status of the Chatbot with ID '${this.chatbotId}'`); | ||
|  | ||
| return response; | ||
| }, | ||
|         
                  michelle0927 marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| }; | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,11 +1,106 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
| import constants from "./common/constants.mjs"; | ||
|  | ||
| export default { | ||
| type: "app", | ||
| app: "chat_data", | ||
| propDefinitions: {}, | ||
| propDefinitions: { | ||
| chatbotId: { | ||
| type: "string", | ||
| label: "Employee ID", | ||
| description: "The employee ID", | ||
|         
                  michelle0927 marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| async options() { | ||
| const response = await this.getChatbots(); | ||
|  | ||
| const chatbotIds = response.chatbots; | ||
|  | ||
| return chatbotIds.map(({ | ||
| chatbotId, chatbotName, | ||
| }) => ({ | ||
| value: chatbotId, | ||
| label: chatbotName, | ||
| })); | ||
| }, | ||
| }, | ||
| chatbotName: { | ||
| type: "string", | ||
| label: "Chatbot Name", | ||
| description: "Name of the Chatbot", | ||
| }, | ||
| sourceText: { | ||
| type: "string", | ||
| label: "Source Text", | ||
| description: "Text data for the chatbot, subject to character limits based on your plan. Relevant only if the model is custom-data-upload", | ||
| optional: true, | ||
| }, | ||
| urlsToScrape: { | ||
| type: "string[]", | ||
| label: "URLs to Scrape", | ||
| description: "A list of URLs is for text content extraction by Chat Data, i.e.: `https://www.chat-data.com`. Relevant only if the model is custom-data-upload", | ||
| optional: true, | ||
| }, | ||
| customBackend: { | ||
| type: "string", | ||
| label: "Custom Backend", | ||
| description: "The URL of a customized backend for the chatbot", | ||
| optional: true, | ||
| }, | ||
| model: { | ||
| type: "string", | ||
| label: "Model", | ||
| description: "The chatbot defaults to `custom-data-upload` if the model parameter is not provided", | ||
| options: constants.CHATBOT_MODELS, | ||
| }, | ||
| }, | ||
| methods: { | ||
| // this.$auth contains connected account data | ||
| authKeys() { | ||
| console.log(Object.keys(this.$auth)); | ||
| _baseUrl() { | ||
| return "https://api.chat-data.com/api/v2"; | ||
| }, | ||
| async _makeRequest(opts = {}) { | ||
| const { | ||
| $ = this, | ||
| path, | ||
| headers, | ||
| ...otherOpts | ||
| } = opts; | ||
| return axios($, { | ||
| ...otherOpts, | ||
| url: this._baseUrl() + path, | ||
| headers: { | ||
| ...headers, | ||
| Authorization: `Bearer ${this.$auth.api_key}`, | ||
| }, | ||
| }); | ||
| }, | ||
| async createChatbot(args = {}) { | ||
| return this._makeRequest({ | ||
| path: "/create-chatbot", | ||
| method: "post", | ||
| ...args, | ||
| }); | ||
| }, | ||
| async getChatbotStatus({ | ||
| chatbotId, ...args | ||
| }) { | ||
| return this._makeRequest({ | ||
| path: `/chatbot/status/${chatbotId}/`, | ||
| ...args, | ||
| }); | ||
| }, | ||
|         
                  michelle0927 marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| async deleteChatbot({ | ||
| chatbotId, ...args | ||
| }) { | ||
| return this._makeRequest({ | ||
| path: `/delete-chatbot/${chatbotId}/`, | ||
| method: "delete", | ||
| ...args, | ||
| }); | ||
| }, | ||
| async getChatbots(args = {}) { | ||
| return this._makeRequest({ | ||
| path: "/get-chatbots", | ||
| ...args, | ||
| }); | ||
| }, | ||
| }, | ||
| }; | ||
| }; | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| export default { | ||
| CHATBOT_MODELS: [ | ||
| "custom-data-upload", | ||
| "medical-chat-human", | ||
| "medical-chat-vet", | ||
| "custom-model", | ||
| ], | ||
| }; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "@pipedream/chat_data", | ||
| "version": "0.0.1", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream Chat Data Components", | ||
| "main": "chat_data.app.mjs", | ||
| "keywords": [ | ||
|  | @@ -11,5 +11,8 @@ | |
| "author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@pipedream/platform": "^3.0.3" | ||
| } | ||
| } | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
      
      Oops, something went wrong.
      
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.