mirror of
https://github.com/ccmjga/zhilu-admin
synced 2026-04-11 00:27:09 +00:00
fix stop bug
This commit is contained in:
@@ -6,8 +6,7 @@ import lombok.Getter;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Getter
|
@Getter
|
||||||
public enum Actions {
|
public enum Actions {
|
||||||
CREATE_USER("CREATE_USER", "创建新用户"),
|
CREATE_USER("CREATE_USER", "创建新用户");
|
||||||
DELETE_USER("DELETE_USER", "删除用户");
|
|
||||||
public static final String INDEX_KEY = "action";
|
public static final String INDEX_KEY = "action";
|
||||||
private final String code;
|
private final String code;
|
||||||
private final String content;
|
private final String content;
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ public class EmbeddingService {
|
|||||||
EmbeddingSearchRequest embeddingSearchRequest =
|
EmbeddingSearchRequest embeddingSearchRequest =
|
||||||
EmbeddingSearchRequest.builder()
|
EmbeddingSearchRequest.builder()
|
||||||
.queryEmbedding(zhipuEmbeddingModel.embed(message).content())
|
.queryEmbedding(zhipuEmbeddingModel.embed(message).content())
|
||||||
|
.minScore(0.9)
|
||||||
.build();
|
.build();
|
||||||
EmbeddingSearchResult<TextSegment> embeddingSearchResult =
|
EmbeddingSearchResult<TextSegment> embeddingSearchResult =
|
||||||
zhiPuEmbeddingStore.search(embeddingSearchRequest);
|
zhiPuEmbeddingStore.search(embeddingSearchRequest);
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ export const useAiChat = () => {
|
|||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
messages.value.pop();
|
messages.value.pop();
|
||||||
|
throw error;
|
||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
}
|
}
|
||||||
@@ -65,7 +66,7 @@ export const useAiChat = () => {
|
|||||||
messages.value.push({
|
messages.value.push({
|
||||||
content: data?.action
|
content: data?.action
|
||||||
? "接收到指令,请您执行。"
|
? "接收到指令,请您执行。"
|
||||||
: "未找到有效指令,请重新输入。",
|
: "未找到有效指令,请告诉我更加准确的信息。",
|
||||||
type: "action",
|
type: "action",
|
||||||
isUser: false,
|
isUser: false,
|
||||||
username: "知路智能体",
|
username: "知路智能体",
|
||||||
|
|||||||
@@ -184,16 +184,16 @@ const chatByMode = async (message: string) => {
|
|||||||
if (isCommandMode.value) {
|
if (isCommandMode.value) {
|
||||||
await actionChat(message);
|
await actionChat(message);
|
||||||
} else {
|
} else {
|
||||||
if (isLoading.value) {
|
await chat(message);
|
||||||
abortChat();
|
|
||||||
} else {
|
|
||||||
await chat(message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSendClick = async () => {
|
const handleSendClick = async () => {
|
||||||
scrollToBottom();
|
scrollToBottom();
|
||||||
|
if (isLoading.value) {
|
||||||
|
abortChat();
|
||||||
|
return;
|
||||||
|
}
|
||||||
const validInputMessage = z
|
const validInputMessage = z
|
||||||
.string({ message: "消息不能为空" })
|
.string({ message: "消息不能为空" })
|
||||||
.min(1, "消息不能为空")
|
.min(1, "消息不能为空")
|
||||||
|
|||||||
Reference in New Issue
Block a user