Browse Source

Merge pull request #214 from Tumao727/feature/code-mode

Update create index js and py template
ryjiang 3 years ago
parent
commit
b5b8183350
2 changed files with 4 additions and 4 deletions
  1. 3 3
      client/src/utils/code/Js.ts
  2. 1 1
      client/src/utils/code/Py.ts

+ 3 - 3
client/src/utils/code/Js.ts

@@ -4,11 +4,11 @@ export const getCreateIndexJSCode = (params: CreateIndexCodeParam) => {
   const { collectionName, fieldName, extraParams } = params;
 
   const jsCode = `import { MilvusClient } from '@zilliz/milvus2-sdk-node';
-const client = new MilvusClient(milvus_address)
+const client = new MilvusClient(milvus_address);
 
 client.indexManager.createIndex({
-  collection_name: ${collectionName},
-  field_name: ${fieldName},
+  collection_name: '${collectionName}',
+  field_name: '${fieldName}',
   extra_params: ${JSON.stringify(extraParams, null, 2)},
 });`;
 

+ 1 - 1
client/src/utils/code/Py.ts

@@ -17,7 +17,7 @@ export const getCreateIndexPYCode = (params: CreateIndexCodeParam) => {
     ...obj,
     params: parseValue(obj.params),
   };
-  const pyCode = `from pymilvus_orm import Collection,
+  const pyCode = `from pymilvus_orm import Collection
 
 collection = Collection('${collectionName}')
 index = ${JSON.stringify(index, replacer, 4)}