Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: AI-generated desc lose space and case info #775 #780

Merged
merged 2 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/publish/form/CommonCategories.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const cateMethods = {
const { chat } = useChatGPT()
const chatText = await chat(inputWord, {
name: "categories",
systemMessage: HtmlUtil.parseHtml(formData.html, AiConstants.MAX_INPUT_TOKEN_LENGTH, true),
systemMessage: formData.md?.substring(0, AiConstants.MAX_INPUT_TOKEN_LENGTH) ?? HtmlUtil.parseHtml(formData.html, AiConstants.MAX_INPUT_TOKEN_LENGTH, true),
})
if (StrUtil.isEmptyString(chatText)) {
ElMessage.error("请求错误,请在偏好设置配置请求地址和ChatGPT key!")
Expand Down
2 changes: 1 addition & 1 deletion src/components/publish/form/PublishCategories.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const fetchCate = async () => {
const { chat } = useChatGPT()
const chatText = await chat(inputWord,{
name: "categories",
systemMessage: HtmlUtil.parseHtml(formData.html, AiConstants.MAX_INPUT_TOKEN_LENGTH, true),
systemMessage: formData.md?.substring(0, AiConstants.MAX_INPUT_TOKEN_LENGTH) ?? HtmlUtil.parseHtml(formData.html, AiConstants.MAX_INPUT_TOKEN_LENGTH, true),
})
if (StrUtil.isEmptyString(chatText)) {
ElMessage.error("请求错误,请在偏好设置配置请求地址和ChatGPT key!")
Expand Down
2 changes: 1 addition & 1 deletion src/components/publish/form/PublishDescription.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const handleMakeDesc = async () => {
const { chat } = useChatGPT()
const chatText = await chat(inputWord, {
name: "desc",
systemMessage: HtmlUtil.parseHtml(formData.html, AiConstants.MAX_INPUT_TOKEN_LENGTH, true),
systemMessage: formData.md?.substring(0, AiConstants.MAX_INPUT_TOKEN_LENGTH) ?? HtmlUtil.parseHtml(formData.html, AiConstants.MAX_INPUT_TOKEN_LENGTH, true),
})
if (StrUtil.isEmptyString(chatText)) {
ElMessage.error("请求错误,请在偏好设置配置请求地址和ChatGPT key!")
Expand Down
2 changes: 1 addition & 1 deletion src/components/publish/form/PublishTags.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const tagMethods = {
const { chat } = useChatGPT()
const chatText = await chat(inputWord, {
name: "tags",
systemMessage: HtmlUtil.parseHtml(formData.html, AiConstants.MAX_INPUT_TOKEN_LENGTH, true),
systemMessage: formData.md?.substring(0, AiConstants.MAX_INPUT_TOKEN_LENGTH) ?? (formData.html, AiConstants.MAX_INPUT_TOKEN_LENGTH, true),
})
if (StrUtil.isEmptyString(chatText)) {
ElMessage.error("请求错误,请在偏好设置配置请求地址和ChatGPT key!")
Expand Down
2 changes: 1 addition & 1 deletion src/components/publish/form/PublishTitle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const handleMakeTitle = async () => {
const { chat } = useChatGPT()
const chatText = await chat(inputWord, {
name: "title",
systemMessage: HtmlUtil.parseHtml(formData.html, AiConstants.MAX_INPUT_TOKEN_LENGTH, true),
systemMessage: formData.md?.substring(0, AiConstants.MAX_INPUT_TOKEN_LENGTH) ?? HtmlUtil.parseHtml(formData.html, AiConstants.MAX_INPUT_TOKEN_LENGTH, true),
})
if (StrUtil.isEmptyString(chatText)) {
ElMessage.error("请求错误,请在偏好设置配置请求地址和ChatGPT key!")
Expand Down