Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
48 changes: 20 additions & 28 deletions docs/ai.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,27 @@ Here is an example configuration for a counter element:
```ts
import { OpenAISchema } from '@tailor-cms/cek-common';

export const Schema: OpenAISchema = {
type: 'json_schema',
name: 'ce_counter',
schema: {
type: 'object',
properties: {
count: { type: 'number' },
description: { type: 'string' },
export const ai = {
Schema: {
type: 'json_schema',
name: 'ce_counter',
schema: {
type: 'object',
properties: {
count: { type: 'number' },
description: { type: 'string' },
},
required: ['count', 'description'],
additionalProperties: false,
},
required: ['count', 'description'],
additionalProperties: false,
},
};

export const getPrompt = () => `
Generate a counter content element as an object with the following
properties:
{
"description": "",
"count": 0
},
where:
- 'description' is the counter description
- 'count' is the number representing the counter value
`;

const ai = {
getPrompt,
Schema,
} as OpenAISchema,
getPrompt: () => `
Generate counter content element as an object with the following
properties: { "description": "", "count": 0 }.
Where:
- 'description' is the counter description
- 'count' is the number representing counter value
`,
processResponse: (val: any) => val,
};
```
Expand Down
4 changes: 1 addition & 3 deletions example/packages/manifest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@
"nuke:dist": "pnpm dlx del-cli dist",
"prepublish": "pnpm build"
},
"dependencies": {
"@tailor-cms/cek-common": "workspace:*"
},
"devDependencies": {
"@tailor-cms/cek-common": "workspace:*",
"@tailor-cms/eslint-config": "workspace:*",
"tsup": "^8.5.0",
"typescript": "^5.8.3"
Expand Down
32 changes: 0 additions & 32 deletions example/packages/manifest/src/ai.ts

This file was deleted.

29 changes: 26 additions & 3 deletions example/packages/manifest/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import type { OpenAISchema } from '@tailor-cms/cek-common';

import type {
DataInitializer,
ElementData,
ElementManifest,
} from './interfaces';
import ai from './ai';

// Element unique id within the target system (e.g. Tailor)
export const type = 'ACME_TCE_COUNTER';
Expand Down Expand Up @@ -37,16 +38,38 @@ export const mocks = {
],
};

export { ai };
export const ai = {
Schema: {
type: 'json_schema',
name: 'ce_counter',
schema: {
type: 'object',
properties: {
count: { type: 'number' },
description: { type: 'string' },
},
required: ['count', 'description'],
additionalProperties: false,
},
} as OpenAISchema,
getPrompt: () => `
Generate counter content element as an object with the following
properties: { "description": "", "count": 0 }.
Where:
- 'description' is the counter description
- 'count' is the number representing counter value
`,
processResponse: (val: any) => val,
};

const manifest: ElementManifest = {
type,
version: '1.0',
name,
initState,
ui,
ai,
mocks,
ai,
};

export default manifest;
Expand Down
1 change: 1 addition & 0 deletions example/packages/server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export default {
onUserInteraction,
beforeDisplay,
mocks,
ai,
};

export { type, initState, mocks, ai };
12 changes: 12 additions & 0 deletions packages/common/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @tailor-cms/cek-common

## 1.2.5

### Patch Changes

- Update content generation handling.

## 1.2.4

### Patch Changes

- Remove request timeout, fix focus on content generate.

## 1.2.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Content element kit shared util library",
"author": "Studion <info@gostudion.com>",
"type": "module",
"version": "1.2.3",
"version": "1.2.5",
"exports": {
".": {
"import": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const getApiClient = (
url: string,
runtime: 'authoring' | 'delivery' = 'authoring',
) => {
const api = ky.create({ prefixUrl: url });
const api = ky.create({ prefixUrl: url, timeout: false });
const opts = { searchParams: { runtime } };

const getElement = (id: string): Promise<any> =>
Expand Down
12 changes: 12 additions & 0 deletions packages/e2e/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @tailor-cms/cek-e2e

## 1.2.5

### Patch Changes

- Update content generation handling.

## 1.2.4

### Patch Changes

- Remove request timeout, fix focus on content generate.

## 1.2.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tailor-cms/cek-e2e",
"version": "1.2.3",
"version": "1.2.5",
"type": "module",
"exports": {
".": {
Expand Down
16 changes: 16 additions & 0 deletions packages/runtime/preview/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# @tailor-cms/tce-preview-runtime

## 1.2.5

### Patch Changes

- Update content generation handling.
- Updated dependencies
- @tailor-cms/cek-common@1.2.5

## 1.2.4

### Patch Changes

- Remove request timeout, fix focus on content generate.
- Updated dependencies
- @tailor-cms/cek-common@1.2.4

## 1.2.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/preview/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@tailor-cms/tce-preview-runtime",
"description": "Preview content element client side runtime",
"author": "Studion <info@gostudion.com>",
"version": "1.2.3",
"version": "1.2.5",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
16 changes: 16 additions & 0 deletions packages/runtime/tce-display/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# @tailor-cms/tce-display-runtime

## 1.2.5

### Patch Changes

- Update content generation handling.
- Updated dependencies
- @tailor-cms/cek-common@1.2.5

## 1.2.4

### Patch Changes

- Remove request timeout, fix focus on content generate.
- Updated dependencies
- @tailor-cms/cek-common@1.2.4

## 1.2.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/tce-display/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@tailor-cms/tce-display-runtime",
"description": "Display content element client side runtime",
"author": "Studion <info@gostudion.com>",
"version": "1.2.3",
"version": "1.2.5",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
16 changes: 16 additions & 0 deletions packages/runtime/tce-edit/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# @tailor-cms/tce-edit-runtime

## 1.2.5

### Patch Changes

- Update content generation handling.
- Updated dependencies
- @tailor-cms/cek-common@1.2.5

## 1.2.4

### Patch Changes

- Remove request timeout, fix focus on content generate.
- Updated dependencies
- @tailor-cms/cek-common@1.2.4

## 1.2.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/tce-edit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@tailor-cms/tce-edit-runtime",
"description": "Edit content element client side runtime",
"author": "Studion <info@gostudion.com>",
"version": "1.2.3",
"version": "1.2.5",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
5 changes: 3 additions & 2 deletions packages/runtime/tce-edit/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ import {
import {
getCurrentInstance,
inject,
nextTick,
onMounted,
provide,
ref,
Expand Down Expand Up @@ -363,9 +364,9 @@ const doTheMagic = async () => {
console.log('Error on element content generate:', error);
} finally {
isGeneratingContent.value = false;
await nextTick();
isFocused.value = true;
}
isGeneratingContent.value = false;
isFocused.value = true;
};

const onLink = () => {
Expand Down
12 changes: 12 additions & 0 deletions packages/runtime/tce-server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @tailor-cms/tce-server-runtime

## 1.2.5

### Patch Changes

- Update content generation handling.

## 1.2.4

### Patch Changes

- Remove request timeout, fix focus on content generate.

## 1.2.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/tce-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@tailor-cms/tce-server-runtime",
"description": "Teaching element server runtime",
"author": "Studion <info@gostudion.com>",
"version": "1.2.3",
"version": "1.2.5",
"type": "module",
"scripts": {
"dev": "node --experimental-specifier-resolution=node --loader ts-node/esm ./boot.ts",
Expand Down
22 changes: 22 additions & 0 deletions packages/tce-boot/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# @tailor-cms/tce-boot

## 1.2.5

### Patch Changes

- Update content generation handling.
- Updated dependencies
- @tailor-cms/tce-display-runtime@1.2.5
- @tailor-cms/tce-server-runtime@1.2.5
- @tailor-cms/tce-edit-runtime@1.2.5
- @tailor-cms/tce-preview-runtime@1.2.5

## 1.2.4

### Patch Changes

- Remove request timeout, fix focus on content generate.
- Updated dependencies
- @tailor-cms/tce-edit-runtime@1.2.4
- @tailor-cms/tce-preview-runtime@1.2.4
- @tailor-cms/tce-display-runtime@1.2.4
- @tailor-cms/tce-server-runtime@1.2.4

## 1.2.3

### Patch Changes
Expand Down
Loading