MCPcopy
hub / github.com/HisMax/RedInk / get_record

Method get_record

backend/services/history.py:156–192  ·  view source on GitHub ↗

获取历史记录详情 Args: record_id: 记录 ID Returns: Optional[Dict]: 记录详情,如果不存在则返回 None 返回数据包含: - id: 记录 ID - title: 标题 - created_at: 创建时间 - updated_at: 更新时间 - outline: 大纲内容 - imag

(self, record_id: str, sync_images: bool = False)

Source from the content-addressed store, hash-verified

154 return record_id
155
156 def get_record(self, record_id: str, sync_images: bool = False) -> Optional[Dict]:
157 """
158 获取历史记录详情
159
160 Args:
161 record_id: 记录 ID
162
163 Returns:
164 Optional[Dict]: 记录详情,如果不存在则返回 None
165
166 返回数据包含:
167 - id: 记录 ID
168 - title: 标题
169 - created_at: 创建时间
170 - updated_at: 更新时间
171 - outline: 大纲内容
172 - images: 图片信息(task_id 和 generated 列表)
173 - status: 当前状态
174 - thumbnail: 缩略图文件名
175 """
176 record_path = self._get_record_path(record_id)
177
178 if not os.path.exists(record_path):
179 return None
180
181 try:
182 with open(record_path, "r", encoding="utf-8") as f:
183 record = json.load(f)
184 except Exception:
185 return None
186
187 if sync_images:
188 synced = self.sync_record_images(record_id, record)
189 if synced.get("success") and synced.get("updated"):
190 return self.get_record(record_id, sync_images=False)
191
192 return record
193
194 def record_exists(self, record_id: str) -> bool:
195 """

Calls 3

_get_record_pathMethod · 0.95
sync_record_imagesMethod · 0.95
getMethod · 0.80