Skip to content

Commit 2706b03

Browse files
committed
feat: ai-assistant localization
1 parent 02f1717 commit 2706b03

107 files changed

Lines changed: 14757 additions & 5920 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/csk/.env.example

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,10 @@ UNIFORM_PREVIEW_SECRET=hello-world
99
# defaults to localhost:3000 if not set.
1010
#When set, should resolve to the base url of the app.
1111
# This is used to generate the sitemap and robots.txt
12-
BASE_URL=
12+
BASE_URL=
13+
14+
# OpenAI API key
15+
OPENAI_API_KEY=
16+
17+
# Postgres data base url
18+
DATABASE_URL=

apps/csk/README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,58 @@ This integration brings new parameter types for design and layout control via Un
6262
![Your project](https://res.cloudinary.com/uniform-demos/image/upload/csk-v-next/doc/project_page.png)
6363
1. Navigate to the `Integrations` tab, find the `Design Extensions` integration and install it.
6464

65+
## 🚀 RAG integration
66+
67+
Retrieval-augmented generation (RAG) keeps your assistant grounded in your content: it fetches the most relevant documents from a Postgres-backed vector store and passes them to the LLM, so answers stay on-topic and up-to-date.
68+
69+
### Step 4. Create a Postgres database
70+
71+
You will need a **Postgres** database to complete this tutorial. If you don’t have Postgres locally you can either:
72+
73+
- Spin up a **free Postgres** instance on [Vercel Postgres](https://vercel.com/postgres).
74+
- Follow [this guide](https://www.postgresqltutorial.com/install-postgresql/) to install Postgres locally.
75+
76+
Once your database is ready, copy its connection string – you’ll need it in the next step.
77+
78+
### Step 5. Migrate the database
79+
80+
1. Open `.env` and paste your **database connection string** after the `DATABASE_URL=` key.
81+
1. Run the migration:
82+
83+
```bash
84+
npm run db:migrate
85+
```
86+
87+
The script will:
88+
89+
- Enable the `pgvector` extension.
90+
- Create tables for the `resources` and `embeddings` schema defined in `src/module/chat/rag/schema` with necessary columns.
91+
92+
1. Fill the data to database:
93+
```bash
94+
npm run db:load
95+
```
96+
97+
### Step 6. Add your OpenAI API key
98+
99+
Some starter features – like AI-Assistant and RAG integration – require an **OpenAI API key**.
100+
101+
1. Generate a key in your OpenAI dashboard: <https://platform.openai.com>.
102+
1. Add it to `.env`:
103+
```bash
104+
OPENAI_API_KEY=
105+
```
106+
107+
### Step 7. Add Webhook (Additional)
108+
109+
You can configure a webhook so your external database (e.g. the Postgres layer you added above) stays automatically up‑to‑date whenever content is published or deleted in Uniform.
110+
111+
1. Open Settings → Webhooks
112+
1. Set the Endpoint URL to: `https://your_domain/api/webhook/entry-event`
113+
1. Enable the following events:
114+
- entry.published
115+
- entry.deleted
116+
65117
## How to sync content
66118

67119
The following scripts are created to facilitate sync of content between the `./content` folder and your project.

apps/csk/content/asset/0aafe2e9-468c-43e1-81f3-fda6c02388e7.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
asset:
2-
type: image
2+
type: other
33
_id: 0aafe2e9-468c-43e1-81f3-fda6c02388e7
44
_name: ''
55
fields:
@@ -26,5 +26,5 @@ asset:
2626
value: 1059
2727
type: number
2828
custom: {}
29-
created: '2025-05-20T11:52:45.655676+00:00'
30-
modified: '2025-07-30T10:58:35.692254+00:00'
29+
created: '2025-05-26T08:40:43.349414+00:00'
30+
modified: '2025-05-26T08:40:43.349414+00:00'

apps/csk/content/asset/1697b6ae-aa6f-4bd6-b844-c8fb3c86216c.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
asset:
2-
type: image
2+
type: other
33
_id: 1697b6ae-aa6f-4bd6-b844-c8fb3c86216c
44
_name: ''
55
fields:
@@ -26,5 +26,5 @@ asset:
2626
value: 24
2727
type: number
2828
custom: {}
29-
created: '2025-05-20T11:52:45.084371+00:00'
30-
modified: '2025-07-30T10:58:36.09021+00:00'
29+
created: '2025-05-26T08:40:43.907922+00:00'
30+
modified: '2025-05-26T08:40:43.907922+00:00'

apps/csk/content/asset/4469d093-0095-43fe-a6f1-9ccd66da351c.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
asset:
2-
type: image
2+
type: other
33
_id: 4469d093-0095-43fe-a6f1-9ccd66da351c
44
_name: ''
55
fields:
@@ -14,17 +14,17 @@ asset:
1414
type: text
1515
url:
1616
value: >-
17-
https://img.uniform.global/p/b0JtaxSVQxmqWylG6vGC1Q/CS_MUTesTAKGcBEXTO1j6Q-icon-cart-white.svg
17+
https://img.uniform.global/p/ZKQcKFSAQZywhvJDNaGQLA/Waeg4FyWQrKmjnom64AveA-icon-cart-white.svg
1818
type: text
1919
size:
2020
value: 904
2121
type: number
2222
width:
23-
value: 150
23+
value: 24
2424
type: number
2525
height:
26-
value: 150
26+
value: 24
2727
type: number
2828
custom: {}
29-
created: '2025-05-21T12:34:40.056281+00:00'
30-
modified: '2025-07-30T10:58:36.300419+00:00'
29+
created: '2025-07-10T10:13:24.994203+00:00'
30+
modified: '2025-08-13T11:16:50.455685+00:00'

apps/csk/content/asset/7770ab14-93dd-46bb-9ef6-7dab66fff401.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
asset:
2-
type: image
2+
type: other
33
_id: 7770ab14-93dd-46bb-9ef6-7dab66fff401
44
_name: ''
55
fields:
@@ -14,17 +14,17 @@ asset:
1414
type: text
1515
url:
1616
value: >-
17-
https://img.uniform.global/p/b0JtaxSVQxmqWylG6vGC1Q/m4mjsV2GSI6f_KZ-lRk4oQ-profile-icon-white.svg
17+
https://img.uniform.global/p/ZKQcKFSAQZywhvJDNaGQLA/sDxp3OOhQ3K-RT30fjN3JA-profile-icon-white.svg
1818
type: text
1919
size:
2020
value: 610
2121
type: number
2222
width:
23-
value: 150
23+
value: 24
2424
type: number
2525
height:
26-
value: 150
26+
value: 24
2727
type: number
2828
custom: {}
29-
created: '2025-05-21T12:36:42.40125+00:00'
30-
modified: '2025-07-30T10:58:37.073949+00:00'
29+
created: '2025-07-10T10:13:44.189532+00:00'
30+
modified: '2025-08-13T11:16:50.372766+00:00'

apps/csk/content/asset/c13180f0-750f-4fc7-837e-46ade3070952.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
asset:
2-
type: image
2+
type: other
33
_id: c13180f0-750f-4fc7-837e-46ade3070952
44
_name: ''
55
fields:
@@ -14,17 +14,17 @@ asset:
1414
type: text
1515
url:
1616
value: >-
17-
https://img.uniform.global/p/b0JtaxSVQxmqWylG6vGC1Q/3tgF3WAjT4W-pYrplHrlGA-favourite-icon-white.svg
17+
https://img.uniform.global/p/ZKQcKFSAQZywhvJDNaGQLA/o79Zj1pzQz6yCvHIM_Hs9A-favourite-icon-white.svg
1818
type: text
1919
size:
2020
value: 722
2121
type: number
2222
width:
23-
value: 150
23+
value: 24
2424
type: number
2525
height:
26-
value: 150
26+
value: 24
2727
type: number
2828
custom: {}
29-
created: '2025-05-21T12:32:56.531809+00:00'
30-
modified: '2025-07-30T10:58:35.850605+00:00'
29+
created: '2025-07-10T10:14:17.185817+00:00'
30+
modified: '2025-08-13T11:16:50.612743+00:00'
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# yaml-language-server: $schema=https://uniform.app/schemas/json-schema/component-definition/v1.json
2+
$schema: https://uniform.app/schemas/json-schema/component-definition/v1.json
3+
id: aiAssistant
4+
name: AI Assistant
5+
icon: ghost-character
6+
parameters:
7+
- id: starterPrompts
8+
name: Starter Prompts
9+
type: $block
10+
typeConfig:
11+
allowedTypes:
12+
- starterPrompt
13+
- id: 49b789f8-b959-448a-a5ec-5248d562905d
14+
name: Modal
15+
type: group
16+
typeConfig:
17+
collapsed: true
18+
childrenParams:
19+
- modalTitle
20+
- modalSubtitle
21+
- inputPlaceholder
22+
- id: modalTitle
23+
name: Modal Title
24+
type: text
25+
typeConfig: null
26+
localizable: true
27+
- id: modalSubtitle
28+
name: Modal Subtitle
29+
type: text
30+
typeConfig: null
31+
localizable: true
32+
- id: inputPlaceholder
33+
name: Input Placeholder
34+
type: text
35+
typeConfig: null
36+
localizable: true
37+
categoryId: 70d03350-bbf9-457d-abc0-cf7d7aa2a3a4
38+
previewImageUrl: >-
39+
https://res.cloudinary.com/uniform-demos/image/upload/csk-v-next/coffee-shop-template/preview-images/ai-assistant.jpg
40+
useTeamPermissions: true
41+
slots: []
42+
canBeComposition: false
43+
created: '2025-07-10T10:17:44.311592+00:00'
44+
updated: '2025-07-17T07:50:09.631686+00:00'
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# yaml-language-server: $schema=<https://uniform.app/schemas/json-schema/component-definition/v1.json>
2+
$schema: https://uniform.app/schemas/json-schema/component-definition/v1.json
3+
id: aiConfiguration
4+
name: AI Configuration
5+
icon: asterisk
6+
parameters: []
7+
categoryId: c7a1d1d9-cc3f-431c-b55e-6c4af1285108
8+
previewImageUrl: >-
9+
https://res.cloudinary.com/uniform-demos/image/upload/csk-v-next/coffee-shop-template/preview-images/ai-configuration.jpg
10+
useTeamPermissions: true
11+
slots:
12+
- id: content
13+
name: Content
14+
allowedComponents: []
15+
allowAllComponents: true
16+
inheritAllowedComponents: false
17+
patternsInAllowedComponents: false
18+
canBeComposition: true
19+
created: '2025-04-24T11:28:17.821117+00:00'
20+
updated: '2025-04-24T11:28:55.575968+00:00'
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# yaml-language-server: $schema=<https://uniform.app/schemas/json-schema/component-definition/v1.json>
2+
$schema: https://uniform.app/schemas/json-schema/component-definition/v1.json
3+
id: assistantScrollSection
4+
name: Assistant Scroll Section
5+
icon: rename
6+
parameters: []
7+
categoryId: 096fd5ed-5e2a-4bfa-834b-fb805d1d1ce9
8+
previewImageUrl: >-
9+
https://res.cloudinary.com/uniform-demos/image/upload/csk-v-next/coffee-shop-template/preview-images/assistant-scroll-section.jpg
10+
useTeamPermissions: true
11+
slots:
12+
- id: content
13+
name: Content
14+
allowedComponents: []
15+
allowAllComponents: true
16+
inheritAllowedComponents: false
17+
patternsInAllowedComponents: false
18+
canBeComposition: false
19+
created: '2025-04-28T12:03:20.971965+00:00'
20+
updated: '2025-04-28T12:03:52.061783+00:00'

0 commit comments

Comments
 (0)