阿里云部署版 DeepSeek 重磅发布,钉钉宜搭低代码平台已完成首发适配,正式推出 DeepSeek 官方连接器,宜搭用户可以更方便地调用 DeepSeek R1、DeepSeek V3 以及蒸馏系列模型。
此前,我们尝试了宜搭接入 DeepSeek API 来作诗;这次,我们用阿里云部署版的 DeepSeek,结合宜搭低代码技术,竟然写出了一段完整的情景剧本。接下来,教你 10 分钟连接 DeepSeek 大模型,制作编剧大师应用。
场景搭建
打开宜搭工作台,右上角创建一个空白应用 -> 新建空白自定义页面,如下图:
页面设计
- 选择多行输入框、按钮、富文本组件:
【非必要】可将控件标题更改自己想要的名称,如按钮标题可更改为「对话」或「呼唤 DeepSeek」;
【建议】多行输入框与按钮控件的唯一标识换成:inputArea
、button
(若不更改,后续需将代码中唯一标识换成控件默认标识),更改入口:
- 配置连接器数据源,如图编辑保存:
连接器数据源名称:callDS
(也可自定义,后续JS 面板
中记得更改);
将 「连接器执行动作参数」中的内容替换为:
{ "maxTokens":1000, "temperature":0, "messages":[ { "role":"user", "content":"今天星期几" } ], "model":"deepseek-r1-distill-qwen-32b" }
注意,此处连接器执行动作参数部分,可以选择调用模型,即 "model" 部分,默认使用 "deepseek-r1-distill-qwen-32b",即阿里云部署版的 DeepSeek R1 模型;你也可以选择 "deepseek-v3" 或 "deepseek-r1" 模型,宜搭均支持接入。
function fit(response) { // 接口返回值会默认增加一层包裹,解析时需注意 const content = (response.content !== undefined) ? response.content : response; // 连接器服务的返回值 const serviceReturnValue = (content && content.serviceReturnValue !== undefined) ? content.serviceReturnValue : content; const error = { message: response.errorMsg || (response.errors && response.errors[0] && response.errors[0].msg) || response.content || '远程数据源请求出错,success is false', }; let success = true; if (response.success !== undefined) { success = response.success; } else if (response.hasError !== undefined) { success = !response.hasError; } return { content: JSON.parse(serviceReturnValue) || content, success, error, }; }
- 配置按钮动作及其
JavaScript
,如下图: - 上述动作面板中
onClick
部分的页面 JS 代码全部替换:
export function onClick() { const content = this.$('minput').getValue(); if (!content) { this.utils.toast({ title: '请输入内容!', type: 'error', }); return; } this.dataSourceMap.callDS.load({ "inputs": JSON.stringify({ "messages": [ { "role": "user", "content": content }, ], "model": "deepseek-r1-distill-qwen-32b" // 默认使用 qwen-32b,即阿里云部署版的 DeepSeek R1模型 }) }).then((res) => { this.utils.toast({ title: '调用成功', type: 'success', }); this.setState({ loading: false, }); this.$('DS').setValue(choices.result.result.content); }).catch((error) => { this.utils.toast({ title: error.message, type: 'error', }); this.setState({ loading: false, }); }); }
制作情景剧本
获取访问地址:上述配置完成,保存页面,切换到页面发布:
宜搭页面调用阿里云部署版 DeepSeek
,写一场情景剧本,成功😄~