32 lines
658 B
TypeScript
32 lines
658 B
TypeScript
/**
|
|
* 错别字检测与修正工具 API
|
|
* 调用 Dify 平台进行错别字检测与修正
|
|
*/
|
|
|
|
export interface DifyRequest {
|
|
inputs: {
|
|
user_input: string
|
|
}
|
|
query: string
|
|
response_mode: string
|
|
}
|
|
|
|
export function checkSpellingWithDify(user_input: string) {
|
|
const requestBody: DifyRequest = {
|
|
inputs: {
|
|
user_input
|
|
},
|
|
query: '1',
|
|
response_mode: 'streaming'
|
|
}
|
|
|
|
return fetch('https://copilot.sino-bridge.com/v1/chat-messages', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'Authorization': 'Bearer app-4SnGvNq4HPxFH4Ie8C0xo7ng'
|
|
},
|
|
body: JSON.stringify(requestBody)
|
|
})
|
|
}
|