Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
371ea87
first version ww-ai chat input
EricHier Jul 10, 2025
fc2203d
v1 function calling and actual AI backend
EricHier Jul 17, 2025
e76a0de
Add first proper function calls
EricHier Jul 17, 2025
5b66c29
v1 of proper function calling and insertion
EricHier Jul 17, 2025
6d63811
new functions and prompt
EricHier Jul 24, 2025
e90c0ff
Enhance element replacement logic and improve prompt structure
EricHier Jul 24, 2025
9c6cd9c
Merge remote-tracking branch 'refs/remotes/webwriter/main' into featu…
EricHier Jul 24, 2025
70531a5
Add `aiPlugin` to editor state configuration and export AI-related pl…
EricHier Jul 24, 2025
b2e5d14
adding markdown formatting
EricHier Jul 30, 2025
5c745be
Adding first version of ai plugin for decorations and reversible ai s…
EricHier Jul 31, 2025
46070d8
Fix: finding nodes
EricHier Jul 31, 2025
0d2c59f
v1 node suggestions
EricHier Jul 31, 2025
4db4940
fixing the removal of ai suggestions
EricHier Aug 14, 2025
c1e7356
adding authorization with simple localstorage
EricHier Aug 14, 2025
cc49d4c
ai suggestions for insert_at_bottom
EricHier Aug 14, 2025
672e85e
nicer ai suggestion styling
EricHier Aug 14, 2025
85939a1
normalize AI suggestions and improve suggestion handling logic
EricHier Aug 14, 2025
b160c68
enhance AI suggestion handling with improved decoration logic and con…
EricHier Aug 14, 2025
e4c38bb
refine user interaction guidelines and update API endpoint for chat r…
EricHier Aug 18, 2025
eb0cb79
implement local storage persistence for AI suggestions and enhance lo…
EricHier Aug 20, 2025
572020a
allowing local widgets and moving to o4-mini
EricHier Aug 20, 2025
828c420
add loading state and spinner to AI chat input for improved user expe…
EricHier Aug 20, 2025
cf6ff74
improving prompts
EricHier Aug 20, 2025
34757c3
refactor widget positioning logic and update documentation on custom …
EricHier Aug 21, 2025
b49bbbd
update dependencies: add Prosemirror packages and upgrade marked version
EricHier Aug 28, 2025
74a63ce
enhance documentation and error handling for widget integration
EricHier Aug 28, 2025
83a78d3
hinweistext hinzufügen und ladeanimation fixen
EricHier Sep 4, 2025
c9f0e74
add initial project configuration files and implement Azure OpenAI AP…
EricHier Sep 4, 2025
74e9fcf
remove unused read_document function and its associated friendly name
EricHier Sep 4, 2025
15588f2
add functions for widget management and LaTeX to MathML conversion; i…
EricHier Sep 4, 2025
7e5e1b1
Improving LLM interface and updating scroll behavior
EricHier Sep 4, 2025
86dfc19
Enhance chat widget: increase max height, add example prompts, and sw…
EricHier Sep 16, 2025
0cbd70a
Enhance chat widget: increase max height, add example prompts, and sw…
EricHier Sep 17, 2025
7c90ff2
Refactor custom elements processing: simplify declaration structure a…
EricHier Sep 17, 2025
b26222e
Enhance AI widget: add loading state handling, implement cancel and r…
EricHier Sep 17, 2025
e6edce7
Enhance document handling: remove long attributes from HTML to preven…
EricHier Sep 17, 2025
27afa31
Moving to english only texts
EricHier Sep 17, 2025
4c74f30
Enhance AI widget: implement localization for chat messages and tool …
EricHier Sep 17, 2025
640a9f4
Enhance AI widget: refactor chat message handling and add LaTeX to Ma…
EricHier Sep 17, 2025
bd8e435
Enhance localization: add new AI-related prompts and messages for mul…
EricHier Sep 18, 2025
c4af888
Enhance AI suggestion handling: update decoration IDs for improved un…
EricHier Sep 18, 2025
a2209f2
Enhance decoration removal logic: improve suggestion ID handling for …
EricHier Sep 25, 2025
6fc9eca
Enhance localization: add "You" prompt to multiple language files
EricHier Sep 25, 2025
b595a4d
Enhance CEM analyzer integration: create dynamic config for JSDoc ext…
EricHier Sep 25, 2025
5fd4642
Fix JSDoc extraction: correct newline character in documentation gene…
EricHier Sep 25, 2025
d029064
Add CEM analyzer configuration and enhance documentation generation
EricHier Oct 1, 2025
bde1bf2
Update API endpoints to point to new server address and using backend…
EricHier Oct 2, 2025
b643813
Fixing bug in ai store
EricHier Oct 2, 2025
8fb302e
Adding login info and minor refactoring
EricHier Oct 2, 2025
dc5515e
Updating translations
EricHier Oct 8, 2025
9411003
Add support for 'ww-ai-tested' package keyword and update styles
EricHier Oct 8, 2025
5219b87
Add delete button for clearing chat history and improve button styles
EricHier Oct 8, 2025
1611118
Adding handling for delete cases, etc
EricHier Oct 9, 2025
90c6d60
Fixing wording and paddings
EricHier Oct 9, 2025
9e80f64
Improving handling of suggestions to fix bug of nested suggestions re…
EricHier Oct 9, 2025
7c7d9c0
Add new translations for WebWriter AI features and clear chat history…
EricHier Oct 21, 2025
e6ff975
Clarify latex usage restrictions in AI store documentation rules
EricHier Oct 21, 2025
4cc4790
Improve suggestion handling by forcing re-decoration on content changes
EricHier Oct 21, 2025
9d0dfac
Clarify formatting and response rules in AI store documentation
EricHier Oct 21, 2025
9982210
Refine AI response rules, improve suggestion handling, and add helper…
EricHier Oct 21, 2025
f215f77
Replace console.error with console.info in AI Store and log content i…
EricHier Oct 28, 2025
da2c44a
improved prompt version
EricHier Dec 10, 2025
9135c9c
updates
EricHier Dec 15, 2025
226e740
fixing bug in store
EricHier Dec 15, 2025
6adf2eb
re-adding readme for compartibility with other widgets
EricHier Jan 7, 2026
0c67e20
updating un-related files back to orignal remote master state
EricHier Jan 8, 2026
af98e58
adding pocketbase hooks
EricHier Jan 8, 2026
1dbb80d
first version ww-ai chat input
EricHier Jul 10, 2025
3362e32
v1 function calling and actual AI backend
EricHier Jul 17, 2025
af695ff
Add first proper function calls
EricHier Jul 17, 2025
2bab190
v1 of proper function calling and insertion
EricHier Jul 17, 2025
2f29e7b
new functions and prompt
EricHier Jul 24, 2025
9f40a3c
Enhance element replacement logic and improve prompt structure
EricHier Jul 24, 2025
b266b45
Add `aiPlugin` to editor state configuration and export AI-related pl…
EricHier Jul 24, 2025
eaaabdf
adding markdown formatting
EricHier Jul 30, 2025
f1000b8
Adding first version of ai plugin for decorations and reversible ai s…
EricHier Jul 31, 2025
ac0782e
Fix: finding nodes
EricHier Jul 31, 2025
336547d
v1 node suggestions
EricHier Jul 31, 2025
7527161
fixing the removal of ai suggestions
EricHier Aug 14, 2025
f595cac
adding authorization with simple localstorage
EricHier Aug 14, 2025
7a52558
ai suggestions for insert_at_bottom
EricHier Aug 14, 2025
385c03e
nicer ai suggestion styling
EricHier Aug 14, 2025
cd7737c
normalize AI suggestions and improve suggestion handling logic
EricHier Aug 14, 2025
aa84042
enhance AI suggestion handling with improved decoration logic and con…
EricHier Aug 14, 2025
a73307b
refine user interaction guidelines and update API endpoint for chat r…
EricHier Aug 18, 2025
bee849c
implement local storage persistence for AI suggestions and enhance lo…
EricHier Aug 20, 2025
78d008d
allowing local widgets and moving to o4-mini
EricHier Aug 20, 2025
60a5856
add loading state and spinner to AI chat input for improved user expe…
EricHier Aug 20, 2025
44d7c63
improving prompts
EricHier Aug 20, 2025
7ebc39d
refactor widget positioning logic and update documentation on custom …
EricHier Aug 21, 2025
6488399
update dependencies: add Prosemirror packages and upgrade marked version
EricHier Aug 28, 2025
cea4ca2
enhance documentation and error handling for widget integration
EricHier Aug 28, 2025
849fc3f
hinweistext hinzufügen und ladeanimation fixen
EricHier Sep 4, 2025
977ccdf
add initial project configuration files and implement Azure OpenAI AP…
EricHier Sep 4, 2025
84443ce
remove unused read_document function and its associated friendly name
EricHier Sep 4, 2025
3355e6d
add functions for widget management and LaTeX to MathML conversion; i…
EricHier Sep 4, 2025
2c34c91
Improving LLM interface and updating scroll behavior
EricHier Sep 4, 2025
387e953
Enhance chat widget: increase max height, add example prompts, and sw…
EricHier Sep 16, 2025
def44fc
Enhance chat widget: increase max height, add example prompts, and sw…
EricHier Sep 17, 2025
5d8982d
Refactor custom elements processing: simplify declaration structure a…
EricHier Sep 17, 2025
2070515
Enhance AI widget: add loading state handling, implement cancel and r…
EricHier Sep 17, 2025
894dc15
Enhance document handling: remove long attributes from HTML to preven…
EricHier Sep 17, 2025
9d546ac
Moving to english only texts
EricHier Sep 17, 2025
4d8f9a0
Enhance AI widget: implement localization for chat messages and tool …
EricHier Sep 17, 2025
cc4bd00
Enhance AI widget: refactor chat message handling and add LaTeX to Ma…
EricHier Sep 17, 2025
0efc13e
Enhance localization: add new AI-related prompts and messages for mul…
EricHier Sep 18, 2025
a90e774
Enhance AI suggestion handling: update decoration IDs for improved un…
EricHier Sep 18, 2025
60caff1
Enhance decoration removal logic: improve suggestion ID handling for …
EricHier Sep 25, 2025
d45407e
Enhance localization: add "You" prompt to multiple language files
EricHier Sep 25, 2025
1c98918
Fix JSDoc extraction: correct newline character in documentation gene…
EricHier Sep 25, 2025
170be2c
Add CEM analyzer configuration and enhance documentation generation
EricHier Oct 1, 2025
fdfbe6e
Update API endpoints to point to new server address and using backend…
EricHier Oct 2, 2025
a7adfc2
Fixing bug in ai store
EricHier Oct 2, 2025
15b2763
Adding login info and minor refactoring
EricHier Oct 2, 2025
9965f50
Updating translations
EricHier Oct 8, 2025
64647a4
Add support for 'ww-ai-tested' package keyword and update styles
EricHier Oct 8, 2025
c681ae5
Add delete button for clearing chat history and improve button styles
EricHier Oct 8, 2025
06a5926
Adding handling for delete cases, etc
EricHier Oct 9, 2025
e0daffd
Fixing wording and paddings
EricHier Oct 9, 2025
c1efc9a
Improving handling of suggestions to fix bug of nested suggestions re…
EricHier Oct 9, 2025
787a831
Add new translations for WebWriter AI features and clear chat history…
EricHier Oct 21, 2025
b2d910c
Clarify latex usage restrictions in AI store documentation rules
EricHier Oct 21, 2025
85546a2
Improve suggestion handling by forcing re-decoration on content changes
EricHier Oct 21, 2025
b1f94b4
Clarify formatting and response rules in AI store documentation
EricHier Oct 21, 2025
d04a9f5
Refine AI response rules, improve suggestion handling, and add helper…
EricHier Oct 21, 2025
d5cd8ee
Replace console.error with console.info in AI Store and log content i…
EricHier Oct 28, 2025
c07476e
improved prompt version
EricHier Dec 10, 2025
04ce126
updates
EricHier Dec 15, 2025
68a007f
fixing bug in store
EricHier Dec 15, 2025
1c54a26
re-adding readme for compartibility with other widgets
EricHier Jan 7, 2026
a72193d
updating un-related files back to orignal remote master state
EricHier Jan 8, 2026
a1c7aa3
adding pocketbase hooks
EricHier Jan 8, 2026
891ea3f
Merge remote-tracking branch 'origin/feature/ww-ai' into feature/ww-ai
EricHier Jan 8, 2026
692dea1
documenting ai widget file
EricHier Jan 8, 2026
8a560d0
documenting ai store and ai plugin properly
EricHier Jan 8, 2026
74c0011
finishing up with AI Plugin styling docu
EricHier Jan 8, 2026
63d5bef
moving PocketBase hooks to correct repo
EricHier Jan 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions @webwriter/build/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,28 +224,28 @@ const themeIDs = memberIDs.filter(id => id.startsWith("./themes/"))

const widgetsTemplate = widgetIDs.map(id => widgetMarkdown(pkg, manifest, id)).join("\n\n")

const snippetsTemplate = !snippetIDs.length? "":
const snippetsTemplate = !snippetIDs.length? "":
`## Snippets
[Snippets](https://webwriter.app/docs/snippets/snippets/) are examples and templates using the package's widgets.

| Name | Import Path |
| :--: | :---------: |
${snippetIDs.map(id => `| ${id.replace("./snippets/", "").replace(".html", "").split("-").map(part => part[0].toUpperCase() + part.slice(1)).join(" ")} | \`${pkg.name + id.slice(1)}\` |`).join("\n")}`

const themesTemplate = !themeIDs.length? "":
const themesTemplate = !themeIDs.length? "":
`## Themes
[Themes](https://webwriter.app/docs/themes/themes/) are stylesheets to apply to a whole document.

| Name | Import Path |
| :--: | :---------: |
${themeIDs.map(id => `| ${id.replace("./themes/", "")} | ${pkg.name + id.slice(1)} |`).join("\n")}`

const prettyName =
const prettyName =
pkg?.editingConfig?.["."]?.label?._ ?? pkg.name.slice(1).split("/")[1].split("-").map(part => part[0].toUpperCase() + part.slice(1)).join(" ")

const description = pkg?.editingConfig?.["."]?.description?._ ?? pkg?.description

const template =
const template =
`# ${prettyName} (\`${pkg.name}@${pkg.version}\`)
[License: ${pkg.license}](LICENSE) | Version: ${pkg.version}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Do not modify this file by hand!
// Re-generate this file by running lit-localize.

/**
* The locale code that templates in this source code are written in.
*/
export const sourceLocale = `en`;

/**
* The other locale codes that this application is localized into. Sorted
* lexicographically.
*/
export const targetLocales = [
`ar`,
`bg`,
`cs`,
`da`,
`de`,
`el`,
`es`,
`et`,
`fi`,
`fr`,
`hu`,
`id`,
`it`,
`ja`,
`ko`,
`lt`,
`lv`,
`nb`,
`nl`,
`pl`,
`pt-BR`,
`pt-PT`,
`ro`,
`ru`,
`sk`,
`sl`,
`sv`,
`tr`,
`uk`,
`zh-Hans`,
`zh-Hant`,
] as const;

/**
* All valid project locale codes. Sorted lexicographically.
*/
export const allLocales = [
`ar`,
`bg`,
`cs`,
`da`,
`de`,
`el`,
`en`,
`es`,
`et`,
`fi`,
`fr`,
`hu`,
`id`,
`it`,
`ja`,
`ko`,
`lt`,
`lv`,
`nb`,
`nl`,
`pl`,
`pt-BR`,
`pt-PT`,
`ro`,
`ru`,
`sk`,
`sl`,
`sv`,
`tr`,
`uk`,
`zh-Hans`,
`zh-Hant`,
] as const;
4 changes: 2 additions & 2 deletions @webwriter/core/model/marshal/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,12 @@ export async function docToBundle(doc: Node, head: Node, noDeps=false, minify=fa
css = ""
}
else {
const jsUrl = new URL("https://api.webwriter.app/ww/v1/_bundles")
const jsUrl = new URL("https://node1.webwriter.elearn.rwth-aachen.de/ww/v1/_bundles")
minify && jsUrl.searchParams.append("minify", "true")
importIDs.forEach(id => jsUrl.searchParams.append("id", id))
const bundleJS = await (await fetch(jsUrl)).text()
js = bundleJS? scopedCustomElementRegistry + ";" + `(function () {${bundleJS}})();`: ""
const cssUrl = new URL("https://api.webwriter.app/ww/v1/_bundles")
const cssUrl = new URL("https://node1.webwriter.elearn.rwth-aachen.de/ww/v1/_bundles")
cssUrl.searchParams.append("pkg", "true")
cssUrl.searchParams.append("type", "css")
minify && cssUrl.searchParams.append("minify", "true")
Expand Down
3 changes: 2 additions & 1 deletion @webwriter/core/model/schemas/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,8 @@ export class Package {
const isWidgetLang = kw.startsWith("widget-lang-")
const isWidgetOnlineStatus = ["widget-online", "widget-online-edit", "widget-online-use"].includes(kw)
const isWebWriterMarker = kw === "webwriter-widget"
return isProgramme || isField || isWidgetType || isWidgetLang || isWidgetOnlineStatus || isWebWriterMarker
const isAIKeyword = kw === "ww-ai-tested"
return isProgramme || isField || isWidgetType || isWidgetLang || isWidgetOnlineStatus || isWebWriterMarker || isAIKeyword
}

get nonstandardKeywords() {
Expand Down
177 changes: 90 additions & 87 deletions @webwriter/core/model/schemas/resource/index.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
import { z } from "zod";
import { Schema, Node } from "prosemirror-model";
import {z} from "zod";
import {Schema, Node} from "prosemirror-model";
import {
EditorState,
EditorStateConfig,
TextSelection,
EditorState,
EditorStateConfig,
TextSelection,
} from "prosemirror-state";
export { undo, redo } from "prosemirror-history";

export {undo, redo} from "prosemirror-history";

import * as marshal from "../../marshal";
import { Package } from "../..";
import {Package} from "../..";
import {
basePlugin,
configFromSchemaPlugins,
formPlugin,
phrasingPlugin,
listPlugin,
mathPlugin,
mediaPlugin,
modalPlugin,
stylePlugin,
svgPlugin,
tablePlugin,
textblockPlugin,
widgetPlugin,
canvasPlugin,
deprecatedPlugin,
headingPlugin,
sectionPlugin,
grammarPlugin,
basePlugin,
configFromSchemaPlugins,
formPlugin,
phrasingPlugin,
listPlugin,
mathPlugin,
mediaPlugin,
modalPlugin,
stylePlugin,
svgPlugin,
tablePlugin,
textblockPlugin,
widgetPlugin,
canvasPlugin,
deprecatedPlugin,
headingPlugin,
sectionPlugin,
grammarPlugin,
aiPlugin
} from "./plugins";
import { EditorStateWithHead, headSchema, initialHeadState } from "./head";
import {EditorStateWithHead, headSchema, initialHeadState} from "./head";

export * from "./plugins";
export * from "./htmlelementspec";
Expand All @@ -38,79 +40,80 @@ export * from "./head";
export * as themes from "./themes";

export function createEditorStateConfig(packages: Package[]) {
return configFromSchemaPlugins([
textblockPlugin(),
headingPlugin(),
mediaPlugin(),
listPlugin(),
sectionPlugin(),
canvasPlugin(),
formPlugin(),
modalPlugin(),
stylePlugin(),
mathPlugin(),
phrasingPlugin(),
svgPlugin(),
// deprecatedPlugin(),
widgetPlugin(packages),
tablePlugin(),
basePlugin(),
grammarPlugin(),
]);
return configFromSchemaPlugins([
textblockPlugin(),
headingPlugin(),
mediaPlugin(),
listPlugin(),
sectionPlugin(),
canvasPlugin(),
formPlugin(),
modalPlugin(),
stylePlugin(),
mathPlugin(),
phrasingPlugin(),
svgPlugin(),
// deprecatedPlugin(),
widgetPlugin(packages),
tablePlugin(),
basePlugin(),
grammarPlugin(),
aiPlugin()
]);
}

export const defaultConfig = createEditorStateConfig([]);

export const createEditorState = (
{
schema = defaultConfig.schema,
doc = defaultConfig.doc,
selection = defaultConfig.selection,
storedMarks = defaultConfig.storedMarks,
plugins = defaultConfig.plugins,
lang = "en",
}: EditorStateConfig & { lang?: string },
head?: Node
{
schema = defaultConfig.schema,
doc = defaultConfig.doc,
selection = defaultConfig.selection,
storedMarks = defaultConfig.storedMarks,
plugins = defaultConfig.plugins,
lang = "en",
}: EditorStateConfig & { lang?: string },
head?: Node
) => {
const resolvedDoc = doc;
let state = EditorState.create({
selection,
storedMarks,
plugins,
doc: resolvedDoc,
});
state = state.apply(state.tr.setSelection(TextSelection.atStart(state.doc)));
const head$ = EditorState.create({
schema: headSchema,
doc: head ?? initialHeadState({ lang }).doc,
});
const resolvedDoc = doc;
let state = EditorState.create({
selection,
storedMarks,
plugins,
doc: resolvedDoc,
});
state = state.apply(state.tr.setSelection(TextSelection.atStart(state.doc)));
const head$ = EditorState.create({
schema: headSchema,
doc: head ?? initialHeadState({lang}).doc,
});

return (
head || lang ? Object.assign(state, { head$ }) : state
) as EditorStateWithHead;
return (
head || lang ? Object.assign(state, {head$}) : state
) as EditorStateWithHead;
};

type Format = keyof typeof marshal;

const ResourceSchema = z.object({
url: z.string().url({ message: "Not a valid URL" }),
editorState: z.instanceof(EditorState).or(
z
.object({
value: z.any(),
schema: z.instanceof(Schema),
})
.transform(async ({ value, schema }) => { // @ts-ignore
for (const parse of Object.values(marshal).map(({ parse }) => parse)) {
try {
return await parse(value, schema);
} catch (e) {
return z.NEVER;
}
}
return z.NEVER;
})
),
url: z.string().url({message: "Not a valid URL"}),
editorState: z.instanceof(EditorState).or(
z
.object({
value: z.any(),
schema: z.instanceof(Schema),
})
.transform(async ({value, schema}) => { // @ts-ignore
for (const parse of Object.values(marshal).map(({parse}) => parse)) {
try {
return await parse(value, schema);
} catch (e) {
return z.NEVER;
}
}
return z.NEVER;
})
),
});

export type Resource = z.infer<typeof ResourceSchema>;
Expand Down
Loading