- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.5k
New Components - dust #14043
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
                    New Components - dust #14043
Changes from all commits
      Commits
    
    
            Show all changes
          
          
            10 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      1eab971
              
                dust init
              
              
                luancazarine 89b56eb
              
                [Components] dust #14021
              
              
                luancazarine c16f283
              
                pnpm update
              
              
                luancazarine 856b79d
              
                Merge branch 'master' into issue-14021
              
              
                luancazarine 2865869
              
                some adjusts
              
              
                luancazarine 78b98b9
              
                some adjusts
              
              
                luancazarine 4446df4
              
                Merge branch 'master' into issue-14021
              
              
                luancazarine 2f11ccd
              
                Require content prop
              
              
                vunguyenhung 19fa8e1
              
                remove optional from prop email
              
              
                luancazarine 52a6553
              
                Merge branch 'master' into issue-14021
              
              
                luancazarine 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
  
    
      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,74 @@ | ||
| import { TIMEZONE_OPTIONS } from "../../common/constants.mjs"; | ||
| import dust from "../../dust.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "dust-talk-assistant", | ||
| name: "Talk to Assistant", | ||
| description: "Send a message to an assistant on Dust and receive an answer. [See the documentation](https://docs.dust.tt/reference/post_api-v1-w-wid-assistant-conversations-cid-messages)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| dust, | ||
| assistantId: { | ||
| propDefinition: [ | ||
| dust, | ||
| "assistantId", | ||
| ], | ||
| }, | ||
| content: { | ||
| type: "string", | ||
| label: "Message Content", | ||
| description: "The content of the message to be sent to the assistant", | ||
| }, | ||
| timezone: { | ||
| type: "string", | ||
| label: "Timezone", | ||
| description: "Set the timezone in which you want to operate.", | ||
| options: TIMEZONE_OPTIONS, | ||
| }, | ||
| username: { | ||
| type: "string", | ||
| label: "Username", | ||
| description: "The name to be displayed in the conversation.", | ||
| }, | ||
| email: { | ||
| type: "string", | ||
| label: "Email", | ||
| description: "Put an email if needed.", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| conversation, message, | ||
| } = await this.dust.sendMessageToAssistant({ | ||
| $, | ||
| data: { | ||
| message: { | ||
| content: this.content, | ||
| context: { | ||
| timezone: this.timezone, | ||
| username: this.username, | ||
| fullName: null, | ||
| email: this.email, | ||
| profilePictureUrl: null, | ||
| }, | ||
| mentions: [ | ||
| { | ||
| configurationId: this.assistantId, | ||
| }, | ||
| ], | ||
| }, | ||
| blocking: true, | ||
| visibility: "unlisted", | ||
| title: null, | ||
| }, | ||
| }); | ||
|  | ||
| $.export("$summary", "Successfully sent message to assistant"); | ||
| return { | ||
| agentMessage: conversation.content[1][0].content, | ||
| conversationUrl: `https://dust.tt/w/${conversation.owner.sId}/assistant/${conversation.sId}`, | ||
| message, | ||
| }; | ||
| }, | ||
| }; | ||
        
          
          
            48 changes: 48 additions & 0 deletions
          
          48 
        
  components/dust/actions/upsert-document/upsert-document.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,48 @@ | ||
| import dust from "../../dust.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "dust-upsert-document", | ||
| name: "Upsert Document", | ||
| description: "Upsert a document to a chosen Dust data source. [See the documentation](https://docs.dust.tt/reference/post_api-v1-w-wid-data-sources-name-documents-documentid)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| dust, | ||
| dataSourceId: { | ||
| propDefinition: [ | ||
| dust, | ||
| "dataSourceId", | ||
| ], | ||
| }, | ||
| documentId: { | ||
| type: "string", | ||
| label: "Document Id", | ||
| description: "An Id for the new document", | ||
| }, | ||
| content: { | ||
| type: "string", | ||
| label: "Content", | ||
| description: "The text content of the document to upsert.", | ||
| }, | ||
| lightDocumentOutput: { | ||
| type: "boolean", | ||
| label: "Light Document Output", | ||
| description: "If true, a lightweight version of the document will be returned in the response (excluding the text, chunks and vectors). Defaults to false.", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.dust.upsertDocument({ | ||
| $, | ||
| dataSourceId: this.dataSourceId, | ||
| documentId: this.documentId, | ||
| data: { | ||
| text: this.content, | ||
| light_document_output: this.lightDocumentOutput, | ||
| }, | ||
| }); | ||
|  | ||
| $.export("$summary", "Successfully uploaded document"); | ||
| return response; | ||
| }, | ||
| }; | 
      
      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.