Skip to content

Commit

Permalink
docs(README): update custom samples and clarify endpoint configuration
Browse files Browse the repository at this point in the history
Update README with corrected typo in "Custom Samples" section and provide additional comments for setting custom API endpoints and configuring prompts. Highlight changes for markdown transformation and editor updates.
  • Loading branch information
phodal committed Nov 6, 2024
1 parent e2c6da1 commit c26cd2c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,15 @@ const BubbleMenu: PromptAction[] = [
];
```

Custom Smamples:
Custom Samples:


```tsx
// custom api endpoint
const actionExecutor: AiActionExecutor = new AiActionExecutor();
actionExecutor.setEndpointUrl("/api/chat");
actionExecutor.setEndpointUrl("/api/chat");

// custom prompts
const instance = PromptsManager.getInstance();
const map = customSlashActions?.map((action) => {
return {
Expand All @@ -159,10 +161,12 @@ const map = customSlashActions?.map((action) => {
};
}) || [];

// set prompts group to default article group
instance.updateActionsMap("article", ArticlePrompts.concat(map));

const editor = useEditor({
extensions: setupExtensions(instance, actionExecutor).concat([
/// configure for copy and paste
Markdown.configure({
transformPastedText: true,
transformCopiedText: false,
Expand All @@ -177,6 +181,7 @@ const editor = useEditor({
},
onUpdate: ({ editor }) => {
if (onChange) {
/// update markdown
const schema = editor.state.schema;
try {
const serializer = DOMSerializer.fromSchema(schema);
Expand Down

0 comments on commit c26cd2c

Please sign in to comment.