Skip to content

Commit 64198c7

Browse files
authored
Merge pull request #80 from opentiny/docs-fix-custom-params-to-server
docs: add custom-action server metadata example, fix angular renderer example error
2 parents 5cc43b8 + 15f6a52 commit 64198c7

2 files changed

Lines changed: 66 additions & 25 deletions

File tree

docs/src/examples/angular/renderer/custom-actions.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,39 +24,39 @@
2424

2525
渲染器支持自定义组件后,同步修改LLM生成对话服务,把自定义的Actions信息发送给大模型。
2626

27-
```ts {12-31}
27+
```ts {9-31}
2828
const response = await fetch(url, {
2929
method: 'POST',
3030
headers: { 'Content-Type': 'application/json' },
3131
body: JSON.stringify({
3232
messages: [{ role: 'user', content: userInput }],
3333
model: 'deepseek-v3.2',
3434
stream: true,
35-
}),
36-
metadata: {
37-
tinygenui: JSON.stringify({
38-
framework: 'Angular',
39-
customActions: [
40-
{
41-
name: 'openPage',
42-
description: '打开新页面',
43-
parameters: {
44-
type: 'object',
45-
properties: {
46-
url: {
47-
type: 'string',
48-
description: '要打开的页面地址',
49-
},
50-
target: {
51-
type: 'string',
52-
description: '打开方式,可选值:_self(当前窗口)、_blank(新窗口)',
35+
metadata: {
36+
tinygenui: JSON.stringify({
37+
framework: 'Angular',
38+
customActions: [
39+
{
40+
name: 'openPage',
41+
description: '打开新页面',
42+
parameters: {
43+
type: 'object',
44+
properties: {
45+
url: {
46+
type: 'string',
47+
description: '要打开的页面地址',
48+
},
49+
target: {
50+
type: 'string',
51+
description: '打开方式,可选值:_self(当前窗口)、_blank(新窗口)',
52+
},
5353
},
54+
required: ['url', 'target'],
5455
},
55-
required: ['url', 'target'],
56-
},
57-
}
58-
]
59-
}),
60-
},
56+
}
57+
]
58+
}),
59+
},
60+
}),
6161
});
6262
```

docs/src/examples/renderer/custom-actions.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,44 @@ const customActions = {
103103
#### 完整示例:
104104

105105
<demo vue="../../../demos/renderer/custom-actions-form.vue" />
106+
107+
108+
## 把自定义组件信息传给 Server
109+
110+
渲染器支持自定义组件后,同步修改LLM生成对话服务,把自定义的Actions信息发送给大模型。
111+
112+
```ts {9-30}
113+
const response = await fetch(url, {
114+
method: 'POST',
115+
headers: { 'Content-Type': 'application/json' },
116+
body: JSON.stringify({
117+
messages: [{ role: 'user', content: userInput }],
118+
model: 'deepseek-v3.2',
119+
stream: true,
120+
metadata: {
121+
tinygenui: JSON.stringify({
122+
customActions: [
123+
{
124+
name: 'openPage',
125+
description: '打开新页面',
126+
parameters: {
127+
type: 'object',
128+
properties: {
129+
url: {
130+
type: 'string',
131+
description: '要打开的页面地址',
132+
},
133+
target: {
134+
type: 'string',
135+
description: '打开方式,可选值:_self(当前窗口)、_blank(新窗口)',
136+
},
137+
},
138+
required: ['url', 'target'],
139+
},
140+
}
141+
]
142+
}),
143+
},
144+
}),
145+
});
146+
```

0 commit comments

Comments
 (0)