Commit Graph

281 Commits

Author SHA1 Message Date
Dominik Seemann b15dc2ea2c
Merge pull request #19 from salestech-group/feat/i18n-6-externalize-backend-logs
feat(i18n): externalize chinese log and api response strings
2026-05-07 17:09:38 +02:00
Dominik Seemann 4f6d5d19a8
Merge pull request #17 from salestech-group/feat/i18n-5-translate-report-agent-prompts
feat(i18n): translate report_agent react prompts to english
2026-05-07 17:08:22 +02:00
Dominik Seemann 0f3ba443dd
Merge pull request #16 from salestech-group/feat/i18n-4-translate-sim-config-prompts
feat(i18n): translate simulation_config_generator prompts to english
2026-05-07 17:07:52 +02:00
Dominik Seemann 1632aaf5fa
Merge pull request #14 from salestech-group/feat/2-translate-ontology-generator-prompts
feat(i18n): translate ontology_generator prompts to english
2026-05-07 17:06:59 +02:00
Dominik Seemann 74997fd088 feat(i18n): externalize chinese log and api response strings
Extract every Chinese string inside backend logger.{info,warning,error,
debug,exception} calls and inside user-facing jsonify({"error|message":
...}) responses across the listed in-scope modules into
locales/{en,zh}.json under nested namespaces (log.<module>.*,
api.{error,message}.<scope>.*). Locale dictionaries stay structurally
identical; the existing flat frontend-facing keys at log.* / api.* are
left untouched. The locale helper (backend/app/utils/locale.py) now
emits a single deduplicated mirofish.locale warning per (locale, key)
pair when a translation is missing instead of silently returning the
raw key, so unknown keys are visible without crashing requests or
background tasks. A repo-root scripts/check_i18n_logs.py verifier
performs an AST-aware source scan for residual Chinese inside the
in-scope logger/jsonify calls and a recursive parity diff between
en.json and zh.json — both modes pass.

Why: backend logs and API errors previously emitted Chinese-only
strings, leaving English-speaking operators with unreadable log
aggregator output and API consumers with locale-mismatched error
messages. The t() helper and per-thread set_locale propagation already
existed; this change makes every backend caller route through them.

Closes #6
2026-05-07 13:52:22 +00:00
Dominik Seemann 22a3ca7af5 feat(i18n): translate report_agent react prompts to english
translate every llm-facing string-literal in
backend/app/services/report_agent.py — the four tool-description
constants, the plan/section/chat system+user prompts, the react loop
templates, the inline messages re-injected during the section and chat
loops, the _execute_tool error returns, and the plan_outline default and
fallback outline content. preserve every {interpolation} token, the
literal final answer: trigger and <tool_call> xml tag, the four primary
tool names, and all three get_language_instruction() postfix call sites.
also switch the unused-tools join separator from "、" to ", " so it
renders naturally inside the now-english react templates.

removes the chinese language bias that the english postfix alone could
not overcome — under accept-language: en the report agent now produces
english-flavoured analytical reports and chat replies; under
accept-language: zh the postfix continues to steer the model into
chinese with no semantic delta. logger calls (#6) and docstrings or
comments (#7) are deliberately untouched.

Closes #5
2026-05-07 12:49:23 +00:00
Dominik Seemann 6c2a412196 feat(i18n): translate simulation_config_generator prompts to english
translate the three llm prompt blocks plus the two prompt-feeding helpers
(_build_context, _summarize_entities) in
backend/app/services/simulation_config_generator.py from chinese to english.
the chinese base prompts were biasing the model toward chinese structure
and lexical choice for content, narrative_direction, hot_topics, and
reasoning fields even when accept-language was en, because
get_language_instruction() only steers the response language as a
postfix.

translation is in-place and preserves every functional contract: the
json output schema for all three prompts, every variable interpolation,
the per-entity-type heuristic ranges in the agent-config prompt, the
trailing english IMPORTANT directives that lock poster_type to
PascalCase and stance to {supportive,opposing,neutral,observer}, and
all three get_language_instruction() postfix call sites. the two
default-path reasoning literals are translated to locale-agnostic
english so generation_reasoning no longer mixes chinese and english on
the failure path.

logger calls, docstrings, and inline comments are intentionally left
chinese (out of scope; covered by issues #6 and #7). public api,
dataclasses, class constants, and the SimulationParameters payload
shape are unchanged.

Closes #4
2026-05-07 11:43:47 +00:00
Dominik Seemann 080683295d feat(i18n): translate ontology_generator prompts to english
translate the system prompt constant and the user-message template in
backend/app/services/ontology_generator.py from chinese to english.
the chinese base prompt was biasing the model toward chinese structure
and word choice even when accept-language was en, leaving ontology
descriptions and analysis_summary fields chinese-flavoured.

translation is in-place and preserves every functional contract: the
json output schema, the entity-type and relationship-type taxonomies
verbatim, the reserved-attribute-name list, the count and length
constraints, and all f-string interpolations. the
get_language_instruction() postfix call site and the trailing english
identifier-format directive are unchanged, so zh and other locales
continue to receive locale-appropriate descriptions.

logger calls, docstrings, and inline comments are intentionally left
in chinese — they are owned by issues #6 and #7.

a small static guard script (backend/scripts/test_ontology_prompts_no_cjk.py)
ast-parses the module and asserts zero cjk in the system prompt and in
every string literal of _build_user_message except the docstring, so
the regression cannot reappear silently.

Closes #2
2026-05-07 09:40:27 +00:00
Dominik Seemann 3b17c0b9ba
Merge pull request #13 from salestech-group/feat/1-finalize-graphiti-neo4j-migration
feat(graphiti): finalize neo4j migration with provider switch
2026-05-07 10:51:05 +02:00
Dominik Seemann 2badf568e7 feat(graphiti): finalize neo4j migration with provider switch
Adds a Neo4j service to docker-compose so `docker compose up -d` works
on a clean checkout, and unhardcodes Graphiti's LLM/embedder so the
documented default provider (Qwen via Dashscope) actually works.

- docker-compose: neo4j:5-community service with cypher-shell
  healthcheck, named volumes, and `depends_on: service_healthy` on the
  app container; in-Docker NEO4J_URI override leaves the host-mode
  default untouched.
- Config: new GRAPHITI_LLM_PROVIDER (openai|gemini, default openai) plus
  optional EMBEDDING_API_KEY / EMBEDDING_BASE_URL that fall back to the
  chat LLM credentials.
- graphiti_adapter: provider switch inside the singleton factory with
  lazy per-provider imports; Gemini path is preserved exactly. The
  no-op `_GeminiReranker` becomes a provider-agnostic
  `_PassthroughReranker`, still injected explicitly so Graphiti does
  not fall back to its OpenAI-only default reranker.
- Drop the ignored `reranker=` kwarg from `_GraphNamespace.search` and
  the misleading callers in `zep_tools.py` and
  `oasis_profile_generator.py`.
- Refresh `.env.example` to mirror the README env section.

Spec, requirements, and design under
`.kiro/specs/graphiti-neo4j-finalize/`.

Closes #1
2026-05-07 08:43:36 +00:00
Dominik Seemann bb81a48727 Create done.md 2026-05-07 10:14:46 +02:00
Dominik Seemann d4f1a9aee0 chore(claude): bootstrap kiro steering files (Step 5)
Add .kiro/steering/ as persistent project memory for CC-SDD / Kiro
workflows. Three core files (product, tech, structure) capture
purpose, stack, and organization patterns; three custom files
(database, api-standards, error-handling) pin the load-bearing
project-specific conventions:

- group_id isolation and the Graphiti adapter / event-loop singleton
- {success, data|error} envelope and the Task polling contract
- reasoning-model output stripping and the retry_with_backoff helper

Files focus on patterns and decisions, not catalogs, per the
steering-principles "golden rule".
2026-05-07 09:39:38 +02:00
Dominik Seemann 8144290fc6 feat(claude): add CC-SDD planning workflow and /plan command (Step 4)
Adopt CC-SDD (Kiro) as the project's spec-driven planning tool, with
plans persisted in .kiro/specs/ and a checkpoint after every task
(strictest cadence — no code without an approved plan).

CC-SDD install (via npx cc-sdd@latest --claude --lang en):
- .kiro/settings/rules/: EARS format, gap-analysis, design and
  requirements review gates, design discovery, tasks generation,
  steering principles, parallel-task analysis.
- .kiro/settings/templates/: specs (init, requirements, design, tasks,
  research) and steering (product/tech/structure plus optional
  api-standards/auth/db/deployment/error-handling/security/testing).
- .claude/commands/kiro/: 11 Kiro slash commands — spec-init,
  spec-requirements, spec-design, spec-tasks, spec-impl, spec-status,
  steering, steering-custom, validate-gap, validate-design,
  validate-impl.

Local additions:
- .claude/commands/plan.md: /plan [task] wrapper that picks up the task
  from $ARGUMENTS or a single .ticket/<n>.md snapshot, walks the Kiro
  flow (steering -> spec-init -> spec-requirements -> validate-gap ->
  spec-design -> validate-design -> spec-tasks) and stops for human
  approval after each artefact. Refuses "just code it" requests.
- .claude/hooks/session_start.sh: extend to print active tickets
  (.ticket/*.md) and open specs (.kiro/specs/*/) with phase from
  spec.json, alongside the existing branch/state line.

Documentation: .claude/onboarding/step4_workflow/01_tool_decision.md
2026-05-06 18:01:41 +02:00
Dominik Seemann 52f78d9fe3 feat(claude): add /ticket and /ticket-list commands for GitHub Issues (Step 3)
Adapt the Notion onboarding prompt — originally Jira/MCP-oriented — to
this project's actual issue tracker (GitHub at
salestech-group/MiroFish) using the gh CLI.

Slash commands (.claude/commands/):
- /ticket <number>: fetch a GitHub issue via gh, self-assign, try to
  add an in-progress label (skips silently if the label doesn't exist),
  and snapshot the issue (frontmatter + body) to .ticket/<n>.md so
  later planning steps can read the description without refetching.
- /ticket-list: interactive overview of issues; asks for filters
  (open/closed, status, assignee, milestone, labels) and runs a single
  gh issue list with the answers, rendering a compact markdown table.

Workspace:
- .ticket/repo.md declares the target repo (GitHub equivalent of the
  Jira "board.md" referenced in the prompt).
- .gitignore: ignore .ticket/* except repo.md and .gitkeep so cached
  ticket markdowns stay local.

Settings:
- Allow-list gh issue view/list/edit/comment, gh repo view,
  gh pr view/list, gh auth status to avoid permission prompts.

Documentation: .claude/onboarding/step3_planning/01_ticket_sync.md
2026-05-06 17:55:42 +02:00
Dominik Seemann 76f719e760 chore(claude): expand permissions and add session/env-guard hooks (Step 2)
Permissions:
- Allow npm run/test/install, uv run/sync, docker (compose), and the
  common read-only/staging git commands so routine work doesn't trigger
  permission prompts.
- Deny Read/Write/Edit on uploads/ and .codegraph/ (auto-generated and
  user-data paths) in addition to the existing .env*/secrets/ blocks.

Hooks:
- SessionStart: print branch, ahead/behind vs upstream, and working-tree
  state at session start so context is visible immediately.
- PreToolUse (Read|Write|Edit|Bash|NotebookEdit): defence-in-depth
  guard that intercepts attempts to access .env / secrets/ paths (and
  bash commands targeting them) with a friendly, logged refusal on top
  of the permissions.deny rules.

PostToolUse formatter is intentionally skipped — the project has no
configured formatter (per the Step 1 conventions decision).
The Stop hook (quality gate) will be configured in Step 6.

Documentation: .claude/onboarding/step2_setup/01_settings_analysis.md
2026-05-06 17:44:16 +02:00
Dominik Seemann 9a77b5921d docs: update CLAUDE.md and resolve README merge conflicts (Step 1)
Bring repo docs in line with the Graphiti+Neo4j migration and prepare
the codebase for Spec-Driven Development.

CLAUDE.md:
- Promote Neo4j + Graphiti to primary memory/graph layer; mark Zep
  Cloud as deprecated / compat-only.
- Document the full env-var surface: NEO4J_*, EMBEDDING_MODEL, optional
  LLM_BOOST_* block.
- Codify must-respect implementation rules (Task model for long ops,
  reasoning-output stripping, simulation IPC, subprocess cleanup,
  startup recovery, per-project group_id isolation, chat prefix
  injection).
- Note i18n (vue-i18n + /locales/) and Docker prerequisite for dev.

README.md / README-EN.md / README-ZH.md:
- Resolve unresolved merge-conflict markers in README.md left over from
  the feat/graphiti-neo4j-migration merge (file was broken Markdown).
- Lead with Docker as the recommended deployment path; keep source
  install as a documented alternative.
- Replace Zep env vars with NEO4J_URI / NEO4J_USER / NEO4J_PASSWORD /
  EMBEDDING_MODEL across all three READMEs.
- Add optional LLM_BOOST_* block with omit-if-unused note.
- Fix language-switcher links between the three READMEs.

.claude/onboarding/step1_codebase/:
- Document repo analysis, CLAUDE.md conventions decisions, and README
  resolution choices.
2026-05-06 17:38:44 +02:00
Dominik Seemann 44eb4588bf chore(claude): set up workspace rules and code conventions (Step 0)
Bootstrap Claude Code Spec-Driven Development:
- .claude/settings.json: allow safe bash (cd, ls, find, cat, mkdir),
  deny .env/secrets and destructive git/rm commands
- .claude/rules/: markdown, file-paths, commits, error-handling,
  dev-guidelines (mirrors Salestech Products Development Guidelines)
- .claude/onboarding/step0_preparation/01_code_conventions.md:
  document the configuration applied
- .gitignore: track project-level .claude/ config; keep
  settings.local.json and .codegraph/ ignored
2026-05-06 17:22:09 +02:00
stg 62648289d1 Merge remote-tracking branch 'abhiyadav2345/feat/graphiti-neo4j-migration' 2026-05-05 15:03:47 +02:00
666ghj fa0f6519b1 docs: rename README-EN.md to README.md as default English documentation 2026-04-02 16:52:29 +08:00
666ghj 0e9420e0f8 docs: rename README.md to README-ZH.md for Chinese documentation 2026-04-02 16:52:29 +08:00
BaiFu 7d07fb7f03
Merge pull request #440 from Ghostubborn/fix/security-deps
fix(security): 修复前端 3 个高危依赖漏洞
2026-04-02 15:17:46 +08:00
ghostubborn 223b283da7 fix(security): upgrade axios, rollup, picomatch to fix 3 high severity vulnerabilities 2026-04-02 15:00:33 +08:00
BaiFu af71244974
Merge pull request #428 from Ghostubborn/feat/i18n
feat(i18n): 添加多语言切换功能,支持中英文
2026-04-02 14:27:04 +08:00
ghostubborn ed465908db fix(i18n): set HTML lang attribute before Vue mounts via inline script 2026-04-02 14:21:09 +08:00
ghostubborn 65df257e19 chore(deps): upgrade vue-i18n from v9 to v11 2026-04-02 14:20:50 +08:00
ghostubborn f2404903d6 fix(i18n): validate Accept-Language header against registered locales 2026-04-02 14:20:15 +08:00
ghostubborn 2421010fe1 fix(i18n): fix English workflow desc font size with correct CSS selectors 2026-04-01 19:11:22 +08:00
ghostubborn 3929c3ade2 fix(i18n): further shorten English metrics and improve workflow layout 2026-04-01 19:07:19 +08:00
ghostubborn 21922da6cc fix(i18n): improve English layout for homepage left-pane and report title
- Add sans-serif font for English left-pane (status, workflow sections)
- Shorten English workflow step descriptions
- Reduce English report title font-size from 36px to 28px
2026-04-01 19:04:38 +08:00
ghostubborn c6cafdd532 fix(i18n): translate world1/world2 platform labels in interview tool display 2026-04-01 18:38:22 +08:00
ghostubborn 5072a2eaa8 feat(i18n): replace Chinese UI text in Step4Report.vue render functions
Only UI display text is replaced. Regex parsing patterns are kept as-is
since they match the backend output format.
2026-04-01 18:35:18 +08:00
ghostubborn 6db3f98a48 fix(i18n): fix English homepage layout with proper font and shorter copy
- Use sans-serif font for English titles, descriptions and navbar
- Shorten English hero text to avoid overflow
- Fix :global() scoped CSS issue that was setting root font-size to 3.5rem
- Use separate unscoped style block for html[lang] selectors
2026-04-01 18:04:05 +08:00
ghostubborn 24e9bee5be feat(i18n): replace all user-visible Chinese logger messages in zep_tools.py
These are shown to users via ConsoleLogger in the report page.
2026-04-01 17:46:39 +08:00
ghostubborn e79569ab4f feat(i18n): replace all user-visible Chinese in report_agent.py
Covers ReportLogger message fields and logger messages shown via ConsoleLogger.
2026-04-01 17:44:52 +08:00
ghostubborn 1d358fc492 feat(i18n): replace expand/collapse Chinese text in Step4Report.vue 2026-04-01 17:44:45 +08:00
666ghj e3350a919d fix(graph): enforce PascalCase for entity names and SCREAMING_SNAKE_CASE for edge names in ontology validation 2026-04-01 17:42:27 +08:00
ghostubborn 380e456d41 fix(i18n): replace hardcoded Chinese stage names in simulation prepare SSE 2026-04-01 17:31:00 +08:00
ghostubborn 3a8451c119 feat(i18n): replace remaining hardcoded Chinese in frontend addLog calls 2026-04-01 17:21:55 +08:00
ghostubborn 0e55e4cf6b feat(i18n): replace remaining Chinese in config generator and profile generator
Also update simulation prompts to be locale-neutral for timezone/schedule.
2026-04-01 17:19:12 +08:00
ghostubborn 7c07237544 fix(i18n): pass locale to background threads via thread-local storage
Background threads (graph building, simulation prep, report generation,
profile generation) now inherit the requesting user's locale preference.
Previously these fell back to 'zh' because Flask request context was
unavailable in spawned threads.
2026-04-01 16:55:51 +08:00
ghostubborn 592ee52f59 feat(i18n): replace remaining hardcoded Chinese in progress callbacks 2026-04-01 16:53:29 +08:00
ghostubborn da2490ec31 fix(i18n): protect JSON field values from language instruction in config generator
Ensure poster_type stays PascalCase English and stance stays English enum
values regardless of language setting. Only natural language fields follow
the user's language preference.
2026-04-01 16:41:22 +08:00
ghostubborn 97aa58384e fix(i18n): ensure ontology names stay PascalCase regardless of language setting
The language instruction was causing LLM to change entity/relation naming
conventions. Now explicitly enforce PascalCase/UPPER_SNAKE_CASE for technical
identifiers while only applying language preference to description fields.
2026-04-01 16:40:17 +08:00
ghostubborn e1db8bacc2 feat(i18n): replace hardcoded Chinese in frontend addLog() messages 2026-04-01 16:35:35 +08:00
ghostubborn 9d43b77511 feat(i18n): replace hardcoded Chinese in backend SSE progress messages 2026-04-01 16:32:10 +08:00
ghostubborn ffe6369c52 fix(i18n): fix curly quotes in Home.vue and remove unused dark theme from LanguageSwitcher 2026-04-01 16:23:52 +08:00
ghostubborn f75c6487b3 fix(i18n): replace remaining hardcoded language directives in LLM prompts
- oasis_profile_generator: replace hardcoded "使用中文" with dynamic get_language_instruction()
- ontology_generator: remove hardcoded "(中文)" from schema annotation
- report_agent: replace Chinese-specific language consistency rules with language-neutral ones
- zep_tools: dynamically select quote style based on locale
2026-04-01 15:55:04 +08:00
ghostubborn fbaa3dbbeb fix(i18n): fix curly quotes and missing @ alias in vite config 2026-04-01 15:45:43 +08:00
ghostubborn fc47ae81b5 feat(i18n): replace hardcoded Chinese in frontend components with i18n calls
Replace all user-visible hardcoded Chinese strings in 7 component files
with $t() / t() calls using vue-i18n:

- Step1GraphBuild: ontology generation, graph build, status badges
- Step2EnvSetup: simulation setup, agent personas, platform config,
  time config, initial activation, modal profile details
- Step3Simulation: report generation button
- Step4Report: section loading text, interaction button
- Step5Interaction: chat interface, survey UI, tool descriptions,
  error messages, agent selection
- GraphPanel: graph status hints, loading states, tooltips
- HistoryDatabase: history cards, modal, replay buttons

Added missing translation keys to both zh.json and en.json locale files.
Added useI18n imports to components that need script-level translations.
2026-04-01 15:43:11 +08:00
ghostubborn 70833821a2 feat(i18n): replace hardcoded Chinese in frontend views with i18n calls 2026-04-01 15:36:29 +08:00