99 :cardProps =" cardPropsSDK" :itemSchema =" itemSchemaSDK" :apiUrl =" SDKAPIUrl"
1010 :titleProps =" ['fsm_name']" />
1111 </div >
12- <div class =" section-title" >{{ $t("rags ") }}</div >
12+ <div class =" section-title" >{{ $t("retrievers ") }}</div >
1313 <div class =" cards-view" >
14- <div class =" no-items" v-if =" !rags || !rags .length" >{{ $t('norags ') }}</div >
15- <Card v-for =" rag in rags " @delete =" initItems" @edit =" () => goTo('ai_config')" :item =" rag "
16- :cardProps =" cardPropsRAG " :itemSchema =" itemSchemaRAG " :apiUrl =" RAGAPIUrl " >
14+ <div class =" no-items" v-if =" !retrievers || !retrievers .length" >{{ $t('noretrievers ') }}</div >
15+ <Card v-for =" retriever in retrievers " @delete =" initItems" @edit =" () => goTo('ai_config')" :item =" retriever "
16+ :cardProps =" cardPropsRetriever " :itemSchema =" itemSchemaRetriever " :apiUrl =" RetrieverAPIUrl " >
1717 <template v-slot :extra-card-bottom =" {item } " >
18- <el-button class =" bottom-card-button" @click =" callRagReindex (item.id, $t)"
18+ <el-button class =" bottom-card-button" @click =" callRetrieverReindex (item.id, $t)"
1919 :disabled =" item.index_status === 'up_to_date'" >
2020 <span >{{ $t("reindex") }}</span >
2121 <el-icon >
2727 <span class =" title" >{{ name }}:</span >
2828 <el-switch
2929 v-model =" item.enabled"
30- :before-change =" () => switchEnabled(item)"
30+ :before-change =" () => switchEnabled(item, RetrieverAPIUrl)"
31+ @click.native.stop
32+ :loading =" loading[item.id]"
33+ :active-value =" true"
34+ :inactive-value =" false"
35+ />
36+ </template >
37+ </Card >
38+ </div >
39+ <div class =" section-title" >{{ $t("llms") }}</div >
40+ <div class =" cards-view" >
41+ <div class =" no-items" v-if =" !llms || !llms.length" >{{ $t('nollms') }}</div >
42+ <Card v-for =" llm in llms" @delete =" initItems" @edit =" () => goTo('ai_config')" :item =" llm"
43+ :cardProps =" cardPropsLLM" :itemSchema =" itemSchemaLLM" :apiUrl =" LLMAPIUrl" >
44+ <template v-slot :enabled =" {item , name } " >
45+ <span class =" title" >{{ name }}:</span >
46+ <el-switch
47+ v-model =" item.enabled"
48+ :before-change =" () => switchEnabled(item, LLMAPIUrl)"
3149 @click.native.stop
3250 :loading =" loading[item.id]"
3351 :active-value =" true"
@@ -51,7 +69,7 @@ import { authHeaders, useItemsStore } from "~/store/items.js";
5169import { useAuthStore } from " ~/store/auth.js" ;
5270import { useI18n } from " vue-i18n" ;
5371import Card from " ~/components/generic/Card.vue" ;
54- import { callRagReindex , upsertItem } from " ~/utils/index.js" ;
72+ import { callRetrieverReindex , upsertItem } from " ~/utils/index.js" ;
5573
5674const { t } = useI18n ();
5775const itemsStore = useItemsStore ();
@@ -61,12 +79,23 @@ const router = useRouter();
6179
6280const loading = ref ({});
6381
64- // -------- RAG --------
65- const RAGAPIUrl = ref (" /back/api/language-model/rag -configs/" );
66- const cardPropsRAG = ref ({
82+ // -------- Retriever --------
83+ const RetrieverAPIUrl = ref (" /back/api/language-model/retriever -configs/" );
84+ const cardPropsRetriever = ref ({
6785 " enabled" : t (" enabled" ),
86+ " model_name" : t (" modelname" ),
87+ " retriever_type" : t (" retrievertype" ),
6888});
69- const itemSchemaRAG = ref ({});
89+ const itemSchemaRetriever = ref ({});
90+
91+ // -------- LLM --------
92+ const LLMAPIUrl = ref (" /back/api/language-model/llm-configs/" );
93+ const cardPropsLLM = ref ({
94+ " enabled" : t (" enabled" ),
95+ " llm_type" : t (" llmtype" ),
96+ " llm_name" : t (" llmname" ),
97+ });
98+ const itemSchemaLLM = ref ({});
7099
71100// -------- Widget --------
72101const WidgetAPIUrl = ref (" /back/api/widget/widgets/" );
@@ -82,21 +111,26 @@ const cardPropsSDK = ref({
82111 " created_date" : t (" created_date" ),
83112});
84113const itemSchemaSDK = ref ({});
85- const rags = ref ([]);
114+
115+ const retrievers = ref ([]);
116+ const llms = ref ([]);
86117const widgets = ref ([]);
87118const sdks = ref ([]);
88119const userName = await authStore .getUserName ()
120+
89121async function initData () {
90122 itemsStore .loading = true ;
91- itemSchemaRAG .value = await itemsStore .getSchemaDef (RAGAPIUrl .value );
123+ itemSchemaRetriever .value = await itemsStore .getSchemaDef (RetrieverAPIUrl .value );
124+ itemSchemaLLM .value = await itemsStore .getSchemaDef (LLMAPIUrl .value );
92125 itemSchemaWidget .value = await itemsStore .getSchemaDef (WidgetAPIUrl .value );
93126 itemSchemaSDK .value = await itemsStore .getSchemaDef (SDKAPIUrl .value );
94127 itemsStore .loading = false ;
95128}
96129
97130async function initItems () {
98131 itemsStore .loading = true ;
99- rags .value = (await $axios .get (RAGAPIUrl .value + " ?enabled=1" , { headers: authHeaders () })).data .results ;
132+ retrievers .value = (await $axios .get (RetrieverAPIUrl .value + " ?enabled=1" , { headers: authHeaders () })).data .results ;
133+ llms .value = (await $axios .get (LLMAPIUrl .value + " ?enabled=1" , { headers: authHeaders () })).data .results ;
100134 widgets .value = (await $axios .get (WidgetAPIUrl .value , { headers: authHeaders () })).data .results ;
101135 sdks .value = (await $axios .get (SDKAPIUrl .value , { headers: authHeaders () })).data .results ;
102136 itemsStore .loading = false ;
@@ -109,10 +143,10 @@ function goTo(route) {
109143 router .push ({ name: route });
110144}
111145
112- async function switchEnabled (item ) {
146+ async function switchEnabled (item , apiUrl ) {
113147 try {
114148 loading .value [item .id ] = true ;
115- const res = await upsertItem (RAGAPIUrl . value , { id: item .id , enabled: ! item .enabled }, itemsStore, false , {}, t);
149+ const res = await upsertItem (apiUrl , { id: item .id , enabled: ! item .enabled }, itemsStore, false , {}, t);
116150 item .enabled = res .enabled ; // Assuming the backend responds with the updated state
117151 loading .value [item .id ] = false ;
118152 } catch (e) {
@@ -123,7 +157,6 @@ async function switchEnabled(item) {
123157
124158 </script >
125159
126-
127160<style lang="scss">
128161.dashboard-wrapper {
129162 margin-left : 146px ;
0 commit comments