Update from Vibe Studio
This commit is contained in:
46
src/api/spell-check-system.ts
Normal file
46
src/api/spell-check-system.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
export interface SpellCheckSystemRequest {
|
||||
text_input: string
|
||||
enable_error_category: boolean
|
||||
enable_correction_suggestion: boolean
|
||||
enable_batch_processing: boolean
|
||||
}
|
||||
|
||||
export interface DifyRequest {
|
||||
inputs: {
|
||||
text_input: string
|
||||
enable_error_category: boolean
|
||||
enable_correction_suggestion: boolean
|
||||
enable_batch_processing: boolean
|
||||
}
|
||||
query: string
|
||||
response_mode: string
|
||||
}
|
||||
|
||||
export interface SpellCheckResult {
|
||||
error_word: string
|
||||
context: string
|
||||
suggestion: string
|
||||
error_type?: string
|
||||
}
|
||||
|
||||
export function detectSpellingErrors(params: SpellCheckSystemRequest) {
|
||||
const requestBody: DifyRequest = {
|
||||
inputs: {
|
||||
text_input: params.text_input,
|
||||
enable_error_category: params.enable_error_category,
|
||||
enable_correction_suggestion: params.enable_correction_suggestion,
|
||||
enable_batch_processing: params.enable_batch_processing
|
||||
},
|
||||
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-YOaqLN0ZBsMozXCoYJqogwiA'
|
||||
},
|
||||
body: JSON.stringify(requestBody)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user