diff --git a/README.md b/README.md
index 9180f72e1..143dc1fd6 100644
--- a/README.md
+++ b/README.md
@@ -56,7 +56,7 @@ OpenIsle 基于 Spring Boot 构建,提供社区后台常见的注册、登录
- `CAPTCHA_POST_ENABLED`:发帖是否需要验证码
- `CAPTCHA_COMMENT_ENABLED`:评论是否需要验证码
- `OPENAI_API_KEY`:OpenAI 接口密钥
- - `OPENAI_MODEL`:调用的模型名称,默认为 `gpt-3.5-turbo`
+ - `OPENAI_MODEL`:调用的模型名称,默认为 `gpt-4o`
2. 启动项目:
```bash
diff --git a/open-isle-cli/src/components/PostEditor.vue b/open-isle-cli/src/components/PostEditor.vue
index 164748978..e35970ecc 100644
--- a/open-isle-cli/src/components/PostEditor.vue
+++ b/open-isle-cli/src/components/PostEditor.vue
@@ -2,7 +2,7 @@
@@ -13,6 +13,9 @@ import Vditor from 'vditor'
import 'vditor/dist/index.css'
import { API_BASE_URL } from '../main'
import { getToken } from '../utils/auth'
+import { hatch } from 'ldrs'
+hatch.register()
+
export default {
name: 'PostEditor',
@@ -37,8 +40,10 @@ export default {
watch(
() => props.loading,
val => {
- if (vditorInstance.value && typeof vditorInstance.value.disabled === 'function') {
- vditorInstance.value.disabled(val)
+ if (val) {
+ vditorInstance.value.disabled()
+ } else {
+ vditorInstance.value.enable()
}
}
)
@@ -127,6 +132,7 @@ export default {
border: 1px solid #e2e2e2;
position: relative;
}
+
.editor-loading-overlay {
position: absolute;
top: 0;
diff --git a/open-isle-cli/src/views/NewPostPageView.vue b/open-isle-cli/src/views/NewPostPageView.vue
index d27fef06d..d55a15519 100644
--- a/open-isle-cli/src/views/NewPostPageView.vue
+++ b/open-isle-cli/src/views/NewPostPageView.vue
@@ -163,9 +163,14 @@ export default {
}
isAiLoading.value = true
try {
+ toast.info('AI 优化中...')
+ const token = getToken()
const res = await fetch(`${API_BASE_URL}/api/ai/format`, {
method: 'POST',
- headers: { 'Content-Type': 'application/json' },
+ headers: {
+ 'Content-Type': 'application/json',
+ Authorization: `Bearer ${token}`
+ },
body: JSON.stringify({ text: content.value })
})
if (res.ok) {
@@ -180,6 +185,7 @@ export default {
isAiLoading.value = false
}
}
+
const submitPost = async () => {
if (!title.value.trim()) {
toast.error('标题不能为空')
diff --git a/src/main/java/com/openisle/service/OpenAiService.java b/src/main/java/com/openisle/service/OpenAiService.java
index 33346677f..8d3b8c42a 100644
--- a/src/main/java/com/openisle/service/OpenAiService.java
+++ b/src/main/java/com/openisle/service/OpenAiService.java
@@ -17,7 +17,7 @@ public class OpenAiService {
@Value("${openai.api-key:}")
private String apiKey;
- @Value("${openai.model:gpt-3.5-turbo}")
+ @Value("${openai.model:gpt-4o}")
private String model;
private final RestTemplate restTemplate = new RestTemplate();
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 83982c3aa..7c1a9375a 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -48,4 +48,4 @@ cos.bucket-name=${COS_BUCKET_NAME:}
google.client-id=${GOOGLE_CLIENT_ID:}
# OpenAI configuration
openai.api-key=${OPENAI_API_KEY:}
-openai.model=${OPENAI_MODEL:gpt-3.5-turbo}
+openai.model=${OPENAI_MODEL:gpt-4o}