#385·Second-Me

全局生成人物简介失败

作者: Cybercricetus创建于 2025年6月10日更新于 2025年6月26日

From the code, we can know that the states BEFORE the creation of global_bio are:

  1. create shades
  2. convert shades to shades info
  3. merge shades Also, we can know that when shades are firstly created, it doesn't have an ID (id = None), so when we are merging the shades, it will regard the shades as empty as there is no id.
python3
                    if not shades:
                        logger.info(
                            f"No valid shades found for shadeIds: {shade_ids}. Skipping this group."
                        )
                        continue

However, I tried to temporarily add id to the shade info class by:

python3
        shades_merge_infos = convert_from_shades_to_merge_info(shades)
        for i in range(len(shades_merge_infos)):
            shades_merge_infos[i].id = str(uuid.uuid4())

I found the first part of the merge shade function would work; but the second half would raise an exception

2025-06-10 22:59:15 [ERROR] shade_generator.py:711 - Traceback (most recent call last):
  File "/app/lpm_kernel/L1/shade_generator.py", line 696, in merge_shades
    new_cluster_embedd = self._calculate_merged_shades_center_embed(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lpm_kernel/L1/shade_generator.py", line 570, in _calculate_merged_shades_center_embed
    len(shades[0].cluster_info["centerEmbedding"])
        ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable

I checked the convert_from_shades_to_merge_info function, I found that:

python3
def convert_from_shades_to_merge_info(shades: List[ShadeInfo]) -> List[ShadeMergeInfo]:
    return [ShadeMergeInfo(
        id=shade.id,
        name=shade.name,
        aspect=shade.aspect,
        icon=shade.icon,
        desc_third_view=shade.desc_third_view,
        content_third_view=shade.content_third_view,
        desc_second_view=shade.desc_second_view,
        content_second_view=shade.content_second_view,
        cluster_info=None
    ) for shade in shades]

It directly set cluster_info as None. Thus, in _calculate_merged_shades_center_embed, when we

内容来源: mindverse/Second-Me