Skip to content

Commit 552722c

Browse files
committed
fix study companion review comments
1 parent e1d064e commit 552722c

17 files changed

Lines changed: 669 additions & 461 deletions

main_logic/core.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2000,15 +2000,16 @@ def _session_changed() -> bool:
20002000
return ""
20012001
cancel_response = getattr(session_snapshot, "cancel_response", None)
20022002
if not callable(cancel_response):
2003-
return action
2003+
return ""
20042004
try:
20052005
if _session_changed():
20062006
return ""
20072007
await cancel_response()
20082008
logger.debug("[%s] voice bridge cancelled current response", self.lanlan_name)
2009+
return action
20092010
except Exception as exc:
20102011
logger.debug("[%s] voice bridge cancel skipped/failed: %s", self.lanlan_name, exc)
2011-
return action
2012+
return ""
20122013

20132014
if action == "prime_context":
20142015
context_text = str(result.get("context") or "").strip()

plugin/plugins/study_companion/entry_notebook.py

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -170,33 +170,43 @@ async def study_notebook_delete(self, notebook_id: str, **_):
170170
async def study_note_upsert(
171171
self,
172172
note_id: str = "",
173-
notebook_id: str = "",
174-
title: str = "",
175-
content: str = "",
173+
notebook_id: str | None = None,
174+
title: str | None = None,
175+
content: str | None = None,
176176
topic_ids: list[str] | None = None,
177177
tags: list[str] | None = None,
178-
is_ai_generated: bool = False,
179-
source_type: str = "manual",
180-
source_ref: str = "",
178+
is_ai_generated: bool | None = None,
179+
source_type: str | None = None,
180+
source_ref: str | None = None,
181181
**_,
182182
):
183183
try:
184-
create_source_type = source_type if not note_id else None
185-
create_source_ref = source_ref if not note_id else None
186-
if note_id and (str(source_type or "").strip() not in {"", "manual"} or str(source_ref or "").strip()):
187-
create_source_type = source_type
188-
create_source_ref = source_ref
184+
note_key = str(note_id or "").strip()
185+
update_kwargs = {"note_id": note_key or None}
186+
if notebook_id is not None:
187+
update_kwargs["notebook_id"] = notebook_id or None
188+
if title is not None:
189+
update_kwargs["title"] = title
190+
if content is not None:
191+
update_kwargs["content"] = content
192+
if topic_ids is not None:
193+
update_kwargs["topic_ids"] = topic_ids
194+
if tags is not None:
195+
update_kwargs["tags"] = tags
196+
if is_ai_generated is not None:
197+
update_kwargs["is_ai_generated"] = is_ai_generated
198+
if not note_key:
199+
update_kwargs["source_type"] = source_type or "manual"
200+
update_kwargs["source_ref"] = source_ref or ""
201+
elif (
202+
source_type is not None
203+
and str(source_type or "").strip() not in {"", "manual"}
204+
) or (source_ref is not None and str(source_ref or "").strip()):
205+
update_kwargs["source_type"] = source_type
206+
update_kwargs["source_ref"] = source_ref
189207
note = await asyncio.to_thread(
190208
self._notebook_store.upsert_note,
191-
note_id=note_id or None,
192-
notebook_id=notebook_id or None,
193-
title=title,
194-
content=content,
195-
topic_ids=topic_ids or [],
196-
tags=tags or [],
197-
is_ai_generated=is_ai_generated,
198-
source_type=create_source_type,
199-
source_ref=create_source_ref,
209+
**update_kwargs,
200210
)
201211
return Ok({"note": _note_dict(note)})
202212
except Exception as exc:

plugin/plugins/study_companion/i18n/es.json

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -196,57 +196,57 @@
196196
"ui.button.rating.good": "Bien",
197197
"ui.button.rating.easy": "Fácil",
198198
"ui.label.name": "Nombre",
199-
"entries.notebook_create.name": "Create Study Notebook",
200-
"entries.notebook_create.description": "Create a folder-like notebook for study notes.",
201-
"entries.notebook_list.name": "List Study Notebooks",
202-
"entries.notebook_list.description": "List study notebooks with note counts.",
203-
"entries.notebook_update.name": "Update Study Notebook",
204-
"entries.notebook_update.description": "Rename or reorder a study notebook.",
205-
"entries.notebook_delete.name": "Delete Study Notebook",
206-
"entries.notebook_delete.description": "Delete a study notebook and keep its notes unfiled.",
207-
"entries.note_upsert.name": "Save Study Note",
208-
"entries.note_upsert.description": "Create or update a Markdown study note.",
209-
"entries.note_get.name": "Get Study Note",
210-
"entries.note_get.description": "Return a single study note by id.",
211-
"entries.note_delete.name": "Delete Study Note",
212-
"entries.note_delete.description": "Delete a study note.",
213-
"entries.note_list.name": "List Study Notes",
214-
"entries.note_list.description": "List study notes by notebook, topic, tag, or query.",
215-
"entries.note_search_all.name": "Search Study Notes",
216-
"entries.note_search_all.description": "Search notes, topics, sessions, and wrong questions.",
217-
"entries.note_ai_expand.name": "Expand Study Note",
218-
"entries.note_ai_expand.description": "Use the tutor model to expand a note without saving the result.",
219-
"entries.note_ai_generate.name": "Generate Study Note",
220-
"entries.note_ai_generate.description": "Summarize a session, topic, OCR text, or supplied text into a note draft without saving it.",
221-
"entries.note_highlight_action.name": "Study Note Highlight Action",
222-
"entries.note_highlight_action.description": "Run an action from selected note text.",
223-
"ui.surface.notebook_panel": "Study Notebook",
224-
"ui.surface.note_editor": "Note Editor",
225-
"ui.surface.note_search": "Study Search",
226-
"ui.status.searching": "Searching...",
227-
"ui.button.save": "Save",
228-
"ui.button.search": "Search",
229-
"ui.label.title": "Title",
230-
"ui.notebook.saved": "Saved",
231-
"ui.notebook.ai_working": "AI working...",
232-
"ui.notebook.new_note": "New note",
233-
"ui.notebook.edit": "Edit",
234-
"ui.notebook.preview": "Preview",
235-
"ui.notebook.ai_expand": "AI Expand",
236-
"ui.notebook.notebook_id": "Notebook",
237-
"ui.notebook.topics": "Topics",
238-
"ui.notebook.tags": "Tags",
239-
"ui.notebook.name_required": "Notebook name is required",
240-
"ui.notebook.new_notebook": "New notebook",
241-
"ui.notebook.all_notes": "All notes",
242-
"ui.notebook.search_placeholder": "Search notes",
243-
"ui.notebook.search_all_placeholder": "Search notes, topics, sessions, wrong questions",
244-
"ui.notebook.empty": "No notes yet",
245-
"ui.notebook.empty_note": "Empty note",
246-
"ui.notebook.select_note": "Select a note",
247-
"ui.notebook.no_results": "No results",
248-
"ui.notebook.tab_notes": "notes",
249-
"ui.notebook.tab_topics": "topics",
250-
"ui.notebook.tab_sessions": "sessions",
251-
"ui.notebook.tab_wrong_questions": "wrong questions"
199+
"entries.notebook_create.name": "Crear cuaderno de estudio",
200+
"entries.notebook_create.description": "Crea un cuaderno tipo carpeta para notas de estudio.",
201+
"entries.notebook_list.name": "Listar cuadernos de estudio",
202+
"entries.notebook_list.description": "Lista cuadernos de estudio con conteo de notas.",
203+
"entries.notebook_update.name": "Actualizar cuaderno de estudio",
204+
"entries.notebook_update.description": "Cambia el nombre o el orden de un cuaderno de estudio.",
205+
"entries.notebook_delete.name": "Eliminar cuaderno de estudio",
206+
"entries.notebook_delete.description": "Elimina un cuaderno de estudio y deja sus notas sin archivar.",
207+
"entries.note_upsert.name": "Guardar nota de estudio",
208+
"entries.note_upsert.description": "Crea o actualiza una nota de estudio en Markdown.",
209+
"entries.note_get.name": "Obtener nota de estudio",
210+
"entries.note_get.description": "Devuelve una sola nota de estudio por id.",
211+
"entries.note_delete.name": "Eliminar nota de estudio",
212+
"entries.note_delete.description": "Elimina una nota de estudio.",
213+
"entries.note_list.name": "Listar notas de estudio",
214+
"entries.note_list.description": "Lista notas por cuaderno, tema, etiqueta o consulta.",
215+
"entries.note_search_all.name": "Buscar notas de estudio",
216+
"entries.note_search_all.description": "Busca en notas, temas, sesiones y preguntas falladas.",
217+
"entries.note_ai_expand.name": "Ampliar nota de estudio",
218+
"entries.note_ai_expand.description": "Usa el modelo tutor para ampliar una nota sin guardar el resultado.",
219+
"entries.note_ai_generate.name": "Generar nota de estudio",
220+
"entries.note_ai_generate.description": "Resume una sesión, tema, texto OCR o texto proporcionado como borrador de nota sin guardarlo.",
221+
"entries.note_highlight_action.name": "Acción de resaltado de nota de estudio",
222+
"entries.note_highlight_action.description": "Ejecuta una acción desde el texto seleccionado de una nota.",
223+
"ui.surface.notebook_panel": "Cuaderno de estudio",
224+
"ui.surface.note_editor": "Editor de notas",
225+
"ui.surface.note_search": "Búsqueda de estudio",
226+
"ui.status.searching": "Buscando...",
227+
"ui.button.save": "Guardar",
228+
"ui.button.search": "Buscar",
229+
"ui.label.title": "Título",
230+
"ui.notebook.saved": "Guardado",
231+
"ui.notebook.ai_working": "La IA está trabajando...",
232+
"ui.notebook.new_note": "Nueva nota",
233+
"ui.notebook.edit": "Editar",
234+
"ui.notebook.preview": "Vista previa",
235+
"ui.notebook.ai_expand": "Ampliar con IA",
236+
"ui.notebook.notebook_id": "Cuaderno",
237+
"ui.notebook.topics": "Temas",
238+
"ui.notebook.tags": "Etiquetas",
239+
"ui.notebook.name_required": "El nombre del cuaderno es obligatorio",
240+
"ui.notebook.new_notebook": "Nuevo cuaderno",
241+
"ui.notebook.all_notes": "Todas las notas",
242+
"ui.notebook.search_placeholder": "Buscar notas",
243+
"ui.notebook.search_all_placeholder": "Buscar notas, temas, sesiones y preguntas falladas",
244+
"ui.notebook.empty": "Aún no hay notas",
245+
"ui.notebook.empty_note": "Nota vacía",
246+
"ui.notebook.select_note": "Selecciona una nota",
247+
"ui.notebook.no_results": "Sin resultados",
248+
"ui.notebook.tab_notes": "notas",
249+
"ui.notebook.tab_topics": "temas",
250+
"ui.notebook.tab_sessions": "sesiones",
251+
"ui.notebook.tab_wrong_questions": "preguntas falladas"
252252
}

plugin/plugins/study_companion/i18n/ko.json

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -196,57 +196,57 @@
196196
"ui.button.rating.good": "좋음",
197197
"ui.button.rating.easy": "쉬움",
198198
"ui.label.name": "이름",
199-
"entries.notebook_create.name": "Create Study Notebook",
200-
"entries.notebook_create.description": "Create a folder-like notebook for study notes.",
201-
"entries.notebook_list.name": "List Study Notebooks",
202-
"entries.notebook_list.description": "List study notebooks with note counts.",
203-
"entries.notebook_update.name": "Update Study Notebook",
204-
"entries.notebook_update.description": "Rename or reorder a study notebook.",
205-
"entries.notebook_delete.name": "Delete Study Notebook",
206-
"entries.notebook_delete.description": "Delete a study notebook and keep its notes unfiled.",
207-
"entries.note_upsert.name": "Save Study Note",
208-
"entries.note_upsert.description": "Create or update a Markdown study note.",
209-
"entries.note_get.name": "Get Study Note",
210-
"entries.note_get.description": "Return a single study note by id.",
211-
"entries.note_delete.name": "Delete Study Note",
212-
"entries.note_delete.description": "Delete a study note.",
213-
"entries.note_list.name": "List Study Notes",
214-
"entries.note_list.description": "List study notes by notebook, topic, tag, or query.",
215-
"entries.note_search_all.name": "Search Study Notes",
216-
"entries.note_search_all.description": "Search notes, topics, sessions, and wrong questions.",
217-
"entries.note_ai_expand.name": "Expand Study Note",
218-
"entries.note_ai_expand.description": "Use the tutor model to expand a note without saving the result.",
219-
"entries.note_ai_generate.name": "Generate Study Note",
220-
"entries.note_ai_generate.description": "Summarize a session, topic, OCR text, or supplied text into a note draft without saving it.",
221-
"entries.note_highlight_action.name": "Study Note Highlight Action",
222-
"entries.note_highlight_action.description": "Run an action from selected note text.",
223-
"ui.surface.notebook_panel": "Study Notebook",
224-
"ui.surface.note_editor": "Note Editor",
225-
"ui.surface.note_search": "Study Search",
226-
"ui.status.searching": "Searching...",
227-
"ui.button.save": "Save",
228-
"ui.button.search": "Search",
229-
"ui.label.title": "Title",
230-
"ui.notebook.saved": "Saved",
231-
"ui.notebook.ai_working": "AI working...",
232-
"ui.notebook.new_note": "New note",
233-
"ui.notebook.edit": "Edit",
234-
"ui.notebook.preview": "Preview",
235-
"ui.notebook.ai_expand": "AI Expand",
236-
"ui.notebook.notebook_id": "Notebook",
237-
"ui.notebook.topics": "Topics",
238-
"ui.notebook.tags": "Tags",
239-
"ui.notebook.name_required": "Notebook name is required",
240-
"ui.notebook.new_notebook": "New notebook",
241-
"ui.notebook.all_notes": "All notes",
242-
"ui.notebook.search_placeholder": "Search notes",
243-
"ui.notebook.search_all_placeholder": "Search notes, topics, sessions, wrong questions",
244-
"ui.notebook.empty": "No notes yet",
245-
"ui.notebook.empty_note": "Empty note",
246-
"ui.notebook.select_note": "Select a note",
247-
"ui.notebook.no_results": "No results",
248-
"ui.notebook.tab_notes": "notes",
249-
"ui.notebook.tab_topics": "topics",
250-
"ui.notebook.tab_sessions": "sessions",
251-
"ui.notebook.tab_wrong_questions": "wrong questions"
199+
"entries.notebook_create.name": "학습 노트북 만들기",
200+
"entries.notebook_create.description": "학습 노트를 담는 폴더형 노트북을 만듭니다.",
201+
"entries.notebook_list.name": "학습 노트북 목록",
202+
"entries.notebook_list.description": "노트 수와 함께 학습 노트북을 나열합니다.",
203+
"entries.notebook_update.name": "학습 노트북 업데이트",
204+
"entries.notebook_update.description": "학습 노트북의 이름이나 순서를 변경합니다.",
205+
"entries.notebook_delete.name": "학습 노트북 삭제",
206+
"entries.notebook_delete.description": "학습 노트북을 삭제하고 노트는 미분류 상태로 둡니다.",
207+
"entries.note_upsert.name": "학습 노트 저장",
208+
"entries.note_upsert.description": "Markdown 학습 노트를 만들거나 업데이트합니다.",
209+
"entries.note_get.name": "학습 노트 가져오기",
210+
"entries.note_get.description": "id로 단일 학습 노트를 반환합니다.",
211+
"entries.note_delete.name": "학습 노트 삭제",
212+
"entries.note_delete.description": "학습 노트를 삭제합니다.",
213+
"entries.note_list.name": "학습 노트 목록",
214+
"entries.note_list.description": "노트북, 주제, 태그 또는 검색어별로 학습 노트를 나열합니다.",
215+
"entries.note_search_all.name": "학습 노트 검색",
216+
"entries.note_search_all.description": "노트, 주제, 세션, 오답을 검색합니다.",
217+
"entries.note_ai_expand.name": "학습 노트 확장",
218+
"entries.note_ai_expand.description": "튜터 모델로 결과를 저장하지 않고 노트를 확장합니다.",
219+
"entries.note_ai_generate.name": "학습 노트 생성",
220+
"entries.note_ai_generate.description": "세션, 주제, OCR 텍스트 또는 입력 텍스트를 저장하지 않는 노트 초안으로 요약합니다.",
221+
"entries.note_highlight_action.name": "학습 노트 선택 텍스트 작업",
222+
"entries.note_highlight_action.description": "노트에서 선택한 텍스트로 작업을 실행합니다.",
223+
"ui.surface.notebook_panel": "학습 노트북",
224+
"ui.surface.note_editor": "노트 편집기",
225+
"ui.surface.note_search": "학습 검색",
226+
"ui.status.searching": "검색 중...",
227+
"ui.button.save": "저장",
228+
"ui.button.search": "검색",
229+
"ui.label.title": "제목",
230+
"ui.notebook.saved": "저장됨",
231+
"ui.notebook.ai_working": "AI 작업 중...",
232+
"ui.notebook.new_note": "새 노트",
233+
"ui.notebook.edit": "편집",
234+
"ui.notebook.preview": "미리보기",
235+
"ui.notebook.ai_expand": "AI로 확장",
236+
"ui.notebook.notebook_id": "노트북",
237+
"ui.notebook.topics": "주제",
238+
"ui.notebook.tags": "태그",
239+
"ui.notebook.name_required": "노트북 이름은 필수입니다",
240+
"ui.notebook.new_notebook": "새 노트북",
241+
"ui.notebook.all_notes": "모든 노트",
242+
"ui.notebook.search_placeholder": "노트 검색",
243+
"ui.notebook.search_all_placeholder": "노트, 주제, 세션, 오답 검색",
244+
"ui.notebook.empty": "아직 노트가 없습니다",
245+
"ui.notebook.empty_note": "빈 노트",
246+
"ui.notebook.select_note": "노트 선택",
247+
"ui.notebook.no_results": "결과 없음",
248+
"ui.notebook.tab_notes": "노트",
249+
"ui.notebook.tab_topics": "주제",
250+
"ui.notebook.tab_sessions": "세션",
251+
"ui.notebook.tab_wrong_questions": "오답"
252252
}

0 commit comments

Comments
 (0)