|
|
|
@ -26,11 +26,11 @@ if utility.has_collection(collection_name):
|
|
|
|
|
|
|
|
|
|
# 5. 定义集合的字段和模式
|
|
|
|
|
fields = [
|
|
|
|
|
FieldSchema(name="id", dtype=DataType.INT64, is_primary=True, auto_id=True), # 主键字段,自动生成 ID
|
|
|
|
|
FieldSchema(name="document_id", dtype=DataType.VARCHAR, max_length=64), # 文档 ID
|
|
|
|
|
FieldSchema(name="user_input", dtype=DataType.VARCHAR, max_length=65535), # 用户问题
|
|
|
|
|
FieldSchema(name="timestamp", dtype=DataType.VARCHAR, max_length=32), # 时间
|
|
|
|
|
FieldSchema(name="embedding", dtype=DataType.FLOAT_VECTOR, dim=MS_DIMENSION) # 向量字段,维度为 200
|
|
|
|
|
FieldSchema(name="id", dtype=DataType.INT64, is_primary=True, auto_id=True),
|
|
|
|
|
FieldSchema(name="tags", dtype=DataType.JSON), # 改为JSON类型存储多个标签
|
|
|
|
|
FieldSchema(name="user_input", dtype=DataType.VARCHAR, max_length=65535),
|
|
|
|
|
FieldSchema(name="timestamp", dtype=DataType.VARCHAR, max_length=32),
|
|
|
|
|
FieldSchema(name="embedding", dtype=DataType.FLOAT_VECTOR, dim=MS_DIMENSION)
|
|
|
|
|
]
|
|
|
|
|
schema_description = "Chat records collection with document_id , user_input, and timestamp"
|
|
|
|
|
|
|
|
|
|