microvoid / marktion Goto Github PK
View Code? Open in Web Editor NEWMarktion is an AI Powered Markdown Editor
Home Page: https://marktion.io
License: MIT License
Marktion is an AI Powered Markdown Editor
Home Page: https://marktion.io
License: MIT License
My editor code
import { ReactEditor, useAI } from "marktion";
import { useRef } from "react";
function Editor() {
const editorRef = useRef(null);
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
const ai = useAI({
basePath: "/api/chat",
});
console.log("ai", ai);
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
return <ReactEditor ref={editorRef} plugins={[ai.plugin]} />;
}
export default Editor;
My openAI code which places at /api/chat folder in nextJs
import OpenAI from "openai";
import { OpenAIStream, StreamingTextResponse } from "ai";
// Create an OpenAI API client (that's edge friendly!)
const openai = new OpenAI({
apiKey: process.env.NEXT_PUBLIC_OPENAI_API_KEY,
});
// Set the runtime to edge for best performance
export const runtime = "edge";
export async function POST(req: Request) {
const { messages } = await req.json();
// Ask OpenAI for a streaming chat completion given the prompt
const response = await openai.chat.completions.create({
model: "gpt-3.5-turbo",
stream: true,
messages,
});
// Convert the response into a friendly text-stream
const stream = OpenAIStream(response);
// Respond with the stream
return new StreamingTextResponse(stream);
}
Just no issues!
just a question. How i remove some plugins, for example, the image?
Also, how i get the HTML? ( i see you are using plugin-markdown)
Keep with good work.
I hope you can maintain this code. 👍 🥇
[tiptap warn]: Duplicate extension names found: ['codeBlock']. This can lead to issues.
at Suspense
at LoadableComponent
at div
at div
at div
at div
at div
at commitPassiveMountOnFiber (webpack-internal:///(app-client)/./node_modules/next/dist/compiled/react-dom-experimental/cjs/react-dom.development.js:23035:9)
at c (webpack-internal:///(app-client)/./node_modules/@headlessui/react/dist/internal/open-closed.js:8:305)
at ye (webpack-internal:///(app-client)/./node_modules/@headlessui/react/dist/components/transitions/transition.js:19:3408)
at commitPassiveMountOnFiber (webpack-internal:///(app-client)/./node_modules/next/dist/compiled/react-dom-experimental/cjs/react-dom.development.js:23035:9)
ExtensionManager @ marktion.js:38622
createExtensionManager @ marktion.js:40801
Editor @ marktion.js:40673
Editor2 @ marktion.js:44277
eval @ marktion.js:44626
...
marktion.js:43021 tippy.jsInteractive tippy element may not be accessible via keyboard navigation because it is not directly after the reference element in the DOM source order. Using a wrapper <div> or <span> tag around the reference element solves this by creating a new parentNode context. Specifying `appendTo: document.body` silences this warning, but it assumes you are using a focus management solution to handle keyboard navigation.
See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity👷 This is a development-only message. It will be removed in production.
表格,todolist 等。
demo 中粘贴被禁用了。
Hi, Can you please suggest how can I reinitialize incoming markdown data, actually I need to update visual data when incoming markdown data is changed. Now it's not updated.
Here is example what I mean: https://codesandbox.io/p/sandbox/test-yrcj88?file=%2Fsrc%2FApp.js%3A1%2C1
Maybe it's related to tiptap
editor itself. Correct me if I am wrong. Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.