mirror of
https://github.com/ccmjga/zhilu-admin
synced 2026-03-19 17:03:46 +08:00
add llm config
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { fetchEventSource } from "@microsoft/fetch-event-source";
|
||||
import { ref } from "vue";
|
||||
import useAuthStore from "../store/useAuthStore";
|
||||
import useAlertStore from "../store/useAlertStore";
|
||||
|
||||
const authStore = useAuthStore();
|
||||
|
||||
|
||||
32
frontend/src/composables/ai/useLlmQuery.ts
Normal file
32
frontend/src/composables/ai/useLlmQuery.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { ref } from "vue";
|
||||
import type { components } from "../../api/types/schema";
|
||||
import client from "../../api/client";
|
||||
|
||||
export const useLlmQuery = () => {
|
||||
const total = ref<number>(0);
|
||||
const llms = ref<components["schemas"]["LlmVm"][]>([]);
|
||||
|
||||
const fetchLlmConfigs = async (page = 1, size = 10, name?: string) => {
|
||||
const { data } = await client.GET("/ai/llm/page-query", {
|
||||
params: {
|
||||
query: {
|
||||
pageRequestDto: {
|
||||
page,
|
||||
size,
|
||||
},
|
||||
llmQueryDto: {
|
||||
name,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
llms.value = data?.data ?? [];
|
||||
total.value = !data || !data.total ? 0 : data.total;
|
||||
};
|
||||
|
||||
return {
|
||||
llms,
|
||||
total,
|
||||
fetchLlmConfigs,
|
||||
};
|
||||
};
|
||||
13
frontend/src/composables/ai/useLlmUpdate.ts
Normal file
13
frontend/src/composables/ai/useLlmUpdate.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import type { components } from "../../api/types/schema";
|
||||
import client from "../../api/client";
|
||||
|
||||
export const useLlmUpdate = () => {
|
||||
const updateLlmConfig = async (llm: components["schemas"]["LlmVm"]) => {
|
||||
await client.PUT("/ai/llm", {
|
||||
body: llm,
|
||||
});
|
||||
};
|
||||
return {
|
||||
updateLlmConfig,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user