feat: v1 — persistent shell, model gateway, artifact improvements (#1462)
This commit is contained in:
parent
3651670fb9
commit
f9652b452a
161 changed files with 5166 additions and 8009 deletions
|
|
@ -8,7 +8,7 @@ import { renderToString } from "react-dom/server";
|
|||
import { MessageResponse } from "@/components/ai-elements/message";
|
||||
|
||||
import { documentSchema } from "./config";
|
||||
import { createSuggestionWidget, type UISuggestion } from "./suggestions";
|
||||
import type { UISuggestion } from "./suggestions";
|
||||
|
||||
export const buildDocumentFromContent = (content: string) => {
|
||||
const parser = DOMParser.fromSchema(documentSchema);
|
||||
|
|
@ -26,7 +26,7 @@ export const buildContentFromDocument = (document: Node) => {
|
|||
|
||||
export const createDecorations = (
|
||||
suggestions: UISuggestion[],
|
||||
view: EditorView
|
||||
_view: EditorView
|
||||
) => {
|
||||
const decorations: Decoration[] = [];
|
||||
|
||||
|
|
@ -37,6 +37,7 @@ export const createDecorations = (
|
|||
suggestion.selectionEnd,
|
||||
{
|
||||
class: "suggestion-highlight",
|
||||
"data-suggestion-id": suggestion.id,
|
||||
},
|
||||
{
|
||||
suggestionId: suggestion.id,
|
||||
|
|
@ -44,21 +45,7 @@ export const createDecorations = (
|
|||
}
|
||||
)
|
||||
);
|
||||
|
||||
decorations.push(
|
||||
Decoration.widget(
|
||||
suggestion.selectionStart,
|
||||
(currentView) => {
|
||||
const { dom } = createSuggestionWidget(suggestion, currentView);
|
||||
return dom;
|
||||
},
|
||||
{
|
||||
suggestionId: suggestion.id,
|
||||
type: "widget",
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return DecorationSet.create(view.state.doc, decorations);
|
||||
return DecorationSet.create(_view.state.doc, decorations);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue