|
3 | 3 | from .types import MergeAddResult, PROMPTS, AddProfile |
4 | 4 | from ....prompts.profile_init_utils import get_specific_subtopics |
5 | 5 | from ....prompts.utils import parse_string_into_subtopics, attribute_unify |
6 | | -from ....models.utils import Promise |
| 6 | +from ....models.utils import Promise, CODE |
7 | 7 | from ....models.response import ProfileData |
8 | 8 | from ....env import CONFIG, TRACE_LOG, ProfileConfig, ContanstTable |
9 | 9 | from ....llms import llm_complete |
@@ -41,7 +41,9 @@ async def organize_profiles( |
41 | 41 | ) |
42 | 42 | if not all([p.ok() for p in ps]): |
43 | 43 | errmsg = "\n".join([p.msg() for p in ps if not p.ok()]) |
44 | | - return Promise.reject(f"Failed to organize profiles: {errmsg}") |
| 44 | + return Promise.reject( |
| 45 | + CODE.INTERNAL_SERVER_ERROR, f"Failed to organize profiles: {errmsg}" |
| 46 | + ) |
45 | 47 |
|
46 | 48 | delete_profile_ids = [] |
47 | 49 | for gs in need_to_organize_topics.values(): |
@@ -113,7 +115,8 @@ async def organize_profiles_by_topic( |
113 | 115 | ] |
114 | 116 | if len(reorganized_profiles) == 0: |
115 | 117 | return Promise.reject( |
116 | | - "Failed to organize profiles, left profiles is 0 so maybe it's the LLM error" |
| 118 | + CODE.SERVER_PARSE_ERROR, |
| 119 | + "Failed to organize profiles, left profiles is 0 so maybe it's the LLM error", |
117 | 120 | ) |
118 | 121 | # forcing the number of subtopics to be less than max_profile_subtopics // 2 + 1 |
119 | 122 | reorganized_profiles = reorganized_profiles[: CONFIG.max_profile_subtopics // 2 + 1] |
|
0 commit comments