知识库创建

This commit is contained in:
2025-11-06 19:08:20 +08:00
parent 0bb4853d54
commit d9947e273c
23 changed files with 2563 additions and 1018 deletions

View File

@@ -6,6 +6,7 @@
<resultMap id="BaseResultMap" type="org.xyzh.common.dto.ai.TbAiKnowledge">
<id column="id" property="id" jdbcType="VARCHAR"/>
<result column="title" property="title" jdbcType="VARCHAR"/>
<result column="avatar" property="avatar" jdbcType="VARCHAR"/>
<result column="description" property="description" jdbcType="VARCHAR"/>
<result column="content" property="content" jdbcType="LONGVARCHAR"/>
<result column="source_type" property="sourceType" jdbcType="INTEGER"/>
@@ -17,6 +18,11 @@
<result column="dify_dataset_id" property="difyDatasetId" jdbcType="VARCHAR"/>
<result column="dify_indexing_technique" property="difyIndexingTechnique" jdbcType="VARCHAR"/>
<result column="embedding_model" property="embeddingModel" jdbcType="VARCHAR"/>
<result column="embedding_model_provider" property="embeddingModelProvider" jdbcType="VARCHAR"/>
<result column="rerank_model" property="rerankModel" jdbcType="VARCHAR"/>
<result column="rerank_model_provider" property="rerankModelProvider" jdbcType="VARCHAR"/>
<result column="retrieval_top_k" property="retrievalTopK" jdbcType="INTEGER"/>
<result column="retrieval_score_threshold" property="retrievalScoreThreshold" jdbcType="DECIMAL"/>
<result column="vector_id" property="vectorID" jdbcType="VARCHAR"/>
<result column="document_count" property="documentCount" jdbcType="INTEGER"/>
<result column="total_chunks" property="totalChunks" jdbcType="INTEGER"/>
@@ -32,8 +38,9 @@
<!-- 基础字段 -->
<sql id="Base_Column_List">
id, title, description, content, source_type, source_id, file_name, file_path,
category, tags, dify_dataset_id, dify_indexing_technique, embedding_model,
id, title, avatar, description, content, source_type, source_id, file_name, file_path,
category, tags, dify_dataset_id, dify_indexing_technique, embedding_model, embedding_model_provider,
rerank_model, rerank_model_provider, retrieval_top_k, retrieval_score_threshold,
vector_id, document_count, total_chunks, status, creator, creator_dept,
updater, create_time, update_time, delete_time, deleted
</sql>
@@ -161,13 +168,15 @@
<!-- insertKnowledge插入知识库 -->
<insert id="insertKnowledge" parameterType="org.xyzh.common.dto.ai.TbAiKnowledge">
INSERT INTO tb_ai_knowledge (
id, title, description, content, source_type, source_id, file_name, file_path,
category, tags, dify_dataset_id, dify_indexing_technique, embedding_model,
id, title, avatar, description, content, source_type, source_id, file_name, file_path,
category, tags, dify_dataset_id, dify_indexing_technique, embedding_model, embedding_model_provider,
rerank_model, rerank_model_provider, retrieval_top_k, retrieval_score_threshold,
vector_id, document_count, total_chunks, status, creator, creator_dept,
updater, create_time, update_time, deleted
) VALUES (
#{ID}, #{title}, #{description}, #{content}, #{sourceType}, #{sourceID}, #{fileName}, #{filePath},
#{category}, #{tags}, #{difyDatasetId}, #{difyIndexingTechnique}, #{embeddingModel},
#{ID}, #{title}, #{avatar}, #{description}, #{content}, #{sourceType}, #{sourceID}, #{fileName}, #{filePath},
#{category}, #{tags}, #{difyDatasetId}, #{difyIndexingTechnique}, #{embeddingModel}, #{embeddingModelProvider},
#{rerankModel}, #{rerankModelProvider}, #{retrievalTopK}, #{retrievalScoreThreshold},
#{vectorID}, #{documentCount}, #{totalChunks}, #{status}, #{creator}, #{creatorDept},
#{updater}, #{createTime}, #{updateTime}, #{deleted}
)
@@ -178,6 +187,7 @@
UPDATE tb_ai_knowledge
<set>
<if test="title != null and title != ''">title = #{title},</if>
<if test="avatar != null">avatar = #{avatar},</if>
<if test="description != null">description = #{description},</if>
<if test="content != null">content = #{content},</if>
<if test="sourceType != null">source_type = #{sourceType},</if>
@@ -189,6 +199,11 @@
<if test="difyDatasetId != null">dify_dataset_id = #{difyDatasetId},</if>
<if test="difyIndexingTechnique != null">dify_indexing_technique = #{difyIndexingTechnique},</if>
<if test="embeddingModel != null">embedding_model = #{embeddingModel},</if>
<if test="embeddingModelProvider != null">embedding_model_provider = #{embeddingModelProvider},</if>
<if test="rerankModel != null">rerank_model = #{rerankModel},</if>
<if test="rerankModelProvider != null">rerank_model_provider = #{rerankModelProvider},</if>
<if test="retrievalTopK != null">retrieval_top_k = #{retrievalTopK},</if>
<if test="retrievalScoreThreshold != null">retrieval_score_threshold = #{retrievalScoreThreshold},</if>
<if test="vectorID != null">vector_id = #{vectorID},</if>
<if test="documentCount != null">document_count = #{documentCount},</if>
<if test="totalChunks != null">total_chunks = #{totalChunks},</if>