Skip to content

Commit

Permalink
fix: fix front end create chatbot model selection
Browse files Browse the repository at this point in the history
  • Loading branch information
IcyKallen committed Oct 23, 2024
1 parent ac1caff commit 4865bb2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
7 changes: 3 additions & 4 deletions source/infrastructure/cli/magic-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,8 @@ async function getAwsAccountAndRegion() {
options.enableChat = config.chat.enabled;
options.bedrockRegion = config.chat.bedrockRegion;
options.enableConnect = config.chat.amazonConnect.enabled;
options.defaultEmbedding = (config.model.embeddingsModels ?? []).filter(
(m: any) => m.default
)[0].name;
options.defaultEmbedding = (config.model.embeddingsModels ?? [])
.find((m: any) => m.default)?.name ?? embeddingModels[0].name;
options.defaultLlm = config.model.llms.find((m) => m.provider === "bedrock")?.name;
options.sagemakerModelS3Bucket = config.model.modelConfig.modelAssetsBucket;
options.enableUI = config.ui.enabled;
Expand Down Expand Up @@ -516,4 +515,4 @@ async function processCreateOptions(options: any): Promise<void> {
).create
? createConfig(config)
: console.log("Skipping");
}
}
12 changes: 9 additions & 3 deletions source/portal/src/pages/chatbotManagement/ChatbotManagement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,16 @@ const ChatbotManagement: React.FC = () => {

const getModelList = async (type: 'create' | 'edit') => {
const tempModels:{label: string; value:string}[] =[]
const BCEMBEDDING = [
{"model_id": config?.embeddingEndpoint || "", "model_name": "BCEmbedding"},
const BCE_EMBEDDING = [
{"model_id": config?.embeddingEndpoint || "", "model_name": "BCE_Embedding"},
]
const embedding_models = config?.kbEnabled === 'true' ? BCEMBEDDING : EMBEDDING_MODEL_LIST
let embedding_models = EMBEDDING_MODEL_LIST

// Check if config?.embeddingEndpoint starts with "bce-embedding-and-bge-reranker"
if (config?.embeddingEndpoint?.startsWith("bce-embedding-and-bge-reranker")) {
embedding_models = [...BCE_EMBEDDING, ...EMBEDDING_MODEL_LIST]
}

embedding_models.forEach((item: {model_id: string; model_name: string})=>{
tempModels.push({
label: item.model_name,
Expand Down

0 comments on commit 4865bb2

Please sign in to comment.