-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create related prompts module (#1642)
- Loading branch information
1 parent
162dc54
commit 36cdcc6
Showing
27 changed files
with
1,212 additions
and
55 deletions.
There are no files selected for viewing
This file contains 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
43 changes: 43 additions & 0 deletions
43
packages/x-components/src/__stubs__/related-prompts-stubs.factory.ts
This file contains 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,43 @@ | ||
import { RelatedPrompt } from '@empathyco/x-types'; | ||
|
||
/** | ||
* Creates a {@link @empathyco/x-types#RelatedPrompt | related prompts} stub. | ||
* | ||
* @param amount - Number of stubbed related prompts to create. | ||
* | ||
* @returns Array of related prompts stub. | ||
* | ||
* @internal | ||
*/ | ||
export function getRelatedPromptsStub(amount = 12): RelatedPrompt[] { | ||
return Array.from({ length: amount }, (_, index) => | ||
createRelatedPromptStub(`Related Prompt ${index + 1}`) | ||
); | ||
} | ||
|
||
/** | ||
* Creates a related prompt stub with the provided options. | ||
* | ||
* @param suggestionText - The suggested text of the related prompt. | ||
* | ||
* @returns A related prompt. | ||
*/ | ||
export function createRelatedPromptStub(suggestionText: string): RelatedPrompt { | ||
return { | ||
suggestionText, | ||
nextQueries: createNextQueriesArrayStub(10), | ||
modelName: 'RelatedPrompt', | ||
type: Math.random() < 0.5 ? 'CURATED' : 'SYNTHETIC' | ||
}; | ||
} | ||
|
||
/** | ||
* Creates an array of next queries. | ||
* | ||
* @param amount - Number of next queries to create. | ||
* | ||
* @returns Array of next queries. | ||
*/ | ||
function createNextQueriesArrayStub(amount: number): string[] { | ||
return Array.from({ length: amount }, (_, index) => `Next query ${index + 1}`); | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
2 changes: 2 additions & 0 deletions
2
packages/x-components/src/x-modules/related-prompts/components/index.ts
This file contains 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,2 @@ | ||
export { default as RelatedPrompt } from './related-prompt.vue'; | ||
export { default as RelatedPromptsList } from './related-prompts-list.vue'; |
Oops, something went wrong.