岗位信息调用润色接口
This commit is contained in:
@@ -213,7 +213,7 @@
|
|||||||
|
|
||||||
<a-layout-footer class="input-footer">
|
<a-layout-footer class="input-footer">
|
||||||
<a-space>
|
<a-space>
|
||||||
<a-button danger size="small" block @click="polishText" :loading="polishLoading"
|
<a-button danger size="small" block @click="polishText('inputValue')" :loading="polishLoading"
|
||||||
:disabled="!inputValue.trim()">
|
:disabled="!inputValue.trim()">
|
||||||
润色
|
润色
|
||||||
</a-button>
|
</a-button>
|
||||||
@@ -290,7 +290,7 @@
|
|||||||
<a-button
|
<a-button
|
||||||
type="default"
|
type="default"
|
||||||
size="small"
|
size="small"
|
||||||
@click="handleCancel"
|
@click="polishText('gangwei')"
|
||||||
style="margin-left:5px;"
|
style="margin-left:5px;"
|
||||||
>
|
>
|
||||||
润色
|
润色
|
||||||
@@ -993,9 +993,10 @@ const sendMessage = () => {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 润色文本功能
|
|
||||||
const polishText = async () => {
|
const polishTextBackStr = async (_inputStr) => {
|
||||||
if (!inputValue.value.trim()) {
|
|
||||||
|
if (_inputStr && !_inputStr.trim()) {
|
||||||
message.warning('请输入需要润色的文本');
|
message.warning('请输入需要润色的文本');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1005,6 +1006,53 @@ const polishText = async () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
polishLoading.value = true;
|
||||||
|
|
||||||
|
//加123的测试效果
|
||||||
|
// const originalText = _inputStr+123;
|
||||||
|
// console.log("originalText",originalText)
|
||||||
|
// return originalText;
|
||||||
|
|
||||||
|
try {
|
||||||
|
console.log('开始润色文本:', originalText);
|
||||||
|
const result = await window.electron.ipcRenderer.invoke('polish-text', originalText);
|
||||||
|
console.log('润色结果:', result);
|
||||||
|
|
||||||
|
if (result.success) {
|
||||||
|
const outstr = result.data;
|
||||||
|
message.success('文本润色完成');
|
||||||
|
return outstr;
|
||||||
|
} else {
|
||||||
|
message.error('润色失败: ' + result.error);
|
||||||
|
console.error('润色失败:', result.error);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('润色文本出错:', error);
|
||||||
|
message.error('润色服务出错: ' + error.message);
|
||||||
|
return "";
|
||||||
|
} finally {
|
||||||
|
polishLoading.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 润色文本功能
|
||||||
|
const polishText = async (targetInputStr) => {
|
||||||
|
|
||||||
|
if(targetInputStr == 'inputValue'){
|
||||||
|
inputValue.value = await polishTextBackStr(inputValue.value);
|
||||||
|
}else if (targetInputStr == 'gangwei'){
|
||||||
|
console.log("formData.infoin",formData.infoin)
|
||||||
|
formData.infoin = await polishTextBackStr(formData.infoin);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (polishLoading.value) {
|
||||||
|
message.warning('正在润色中,请稍候...');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
polishLoading.value = true;
|
polishLoading.value = true;
|
||||||
const originalText = inputValue.value;
|
const originalText = inputValue.value;
|
||||||
|
|
||||||
@@ -1026,6 +1074,7 @@ const polishText = async () => {
|
|||||||
} finally {
|
} finally {
|
||||||
polishLoading.value = false;
|
polishLoading.value = false;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
// 文件处理函数
|
// 文件处理函数
|
||||||
|
|||||||
Reference in New Issue
Block a user