diff --git a/.serena/.gitignore b/.serena/.gitignore new file mode 100644 index 0000000..2e510af --- /dev/null +++ b/.serena/.gitignore @@ -0,0 +1,2 @@ +/cache +/project.local.yml diff --git a/.serena/project.yml b/.serena/project.yml new file mode 100644 index 0000000..bd11eb7 --- /dev/null +++ b/.serena/project.yml @@ -0,0 +1,138 @@ +# the name by which the project can be referenced within Serena +project_name: "JGJS2026" + + +# list of languages for which language servers are started; choose from: +# al bash clojure cpp csharp +# csharp_omnisharp dart elixir elm erlang +# fortran fsharp go groovy haskell +# java julia kotlin lua markdown +# matlab nix pascal perl php +# php_phpactor powershell python python_jedi r +# rego ruby ruby_solargraph rust scala +# swift terraform toml typescript typescript_vts +# vue yaml zig +# (This list may be outdated. For the current list, see values of Language enum here: +# https://github.com/oraios/serena/blob/main/src/solidlsp/ls_config.py +# For some languages, there are alternative language servers, e.g. csharp_omnisharp, ruby_solargraph.) +# Note: +# - For C, use cpp +# - For JavaScript, use typescript +# - For Free Pascal/Lazarus, use pascal +# Special requirements: +# Some languages require additional setup/installations. +# See here for details: https://oraios.github.io/serena/01-about/020_programming-languages.html#language-servers +# When using multiple languages, the first language server that supports a given file will be used for that file. +# The first language is the default language and the respective language server will be used as a fallback. +# Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored. +languages: +- vue + +# the encoding used by text files in the project +# For a list of possible encodings, see https://docs.python.org/3.11/library/codecs.html#standard-encodings +encoding: "utf-8" + +# line ending convention to use when writing source files. +# Possible values: unset (use global setting), "lf", "crlf", or "native" (platform default) +# This does not affect Serena's own files (e.g. memories and configuration files), which always use native line endings. +line_ending: + +# The language backend to use for this project. +# If not set, the global setting from serena_config.yml is used. +# Valid values: LSP, JetBrains +# Note: the backend is fixed at startup. If a project with a different backend +# is activated post-init, an error will be returned. +language_backend: + +# whether to use project's .gitignore files to ignore files +ignore_all_files_in_gitignore: true + +# list of additional paths to ignore in this project. +# Same syntax as gitignore, so you can use * and **. +# Note: global ignored_paths from serena_config.yml are also applied additively. +ignored_paths: [] + +# whether the project is in read-only mode +# If set to true, all editing tools will be disabled and attempts to use them will result in an error +# Added on 2025-04-18 +read_only: false + +# list of tool names to exclude. +# This extends the existing exclusions (e.g. from the global configuration) +# +# Below is the complete list of tools for convenience. +# To make sure you have the latest list of tools, and to view their descriptions, +# execute `uv run scripts/print_tool_overview.py`. +# +# * `activate_project`: Activates a project by name. +# * `check_onboarding_performed`: Checks whether project onboarding was already performed. +# * `create_text_file`: Creates/overwrites a file in the project directory. +# * `delete_lines`: Deletes a range of lines within a file. +# * `delete_memory`: Deletes a memory from Serena's project-specific memory store. +# * `execute_shell_command`: Executes a shell command. +# * `find_referencing_code_snippets`: Finds code snippets in which the symbol at the given location is referenced. +# * `find_referencing_symbols`: Finds symbols that reference the symbol at the given location (optionally filtered by type). +# * `find_symbol`: Performs a global (or local) search for symbols with/containing a given name/substring (optionally filtered by type). +# * `get_current_config`: Prints the current configuration of the agent, including the active and available projects, tools, contexts, and modes. +# * `get_symbols_overview`: Gets an overview of the top-level symbols defined in a given file. +# * `initial_instructions`: Gets the initial instructions for the current project. +# Should only be used in settings where the system prompt cannot be set, +# e.g. in clients you have no control over, like Claude Desktop. +# * `insert_after_symbol`: Inserts content after the end of the definition of a given symbol. +# * `insert_at_line`: Inserts content at a given line in a file. +# * `insert_before_symbol`: Inserts content before the beginning of the definition of a given symbol. +# * `list_dir`: Lists files and directories in the given directory (optionally with recursion). +# * `list_memories`: Lists memories in Serena's project-specific memory store. +# * `onboarding`: Performs onboarding (identifying the project structure and essential tasks, e.g. for testing or building). +# * `prepare_for_new_conversation`: Provides instructions for preparing for a new conversation (in order to continue with the necessary context). +# * `read_file`: Reads a file within the project directory. +# * `read_memory`: Reads the memory with the given name from Serena's project-specific memory store. +# * `remove_project`: Removes a project from the Serena configuration. +# * `replace_lines`: Replaces a range of lines within a file with new content. +# * `replace_symbol_body`: Replaces the full definition of a symbol. +# * `restart_language_server`: Restarts the language server, may be necessary when edits not through Serena happen. +# * `search_for_pattern`: Performs a search for a pattern in the project. +# * `summarize_changes`: Provides instructions for summarizing the changes made to the codebase. +# * `switch_modes`: Activates modes by providing a list of their names +# * `think_about_collected_information`: Thinking tool for pondering the completeness of collected information. +# * `think_about_task_adherence`: Thinking tool for determining whether the agent is still on track with the current task. +# * `think_about_whether_you_are_done`: Thinking tool for determining whether the task is truly completed. +# * `write_memory`: Writes a named memory (for future reference) to Serena's project-specific memory store. +excluded_tools: [] + +# list of tools to include that would otherwise be disabled (particularly optional tools that are disabled by default). +# This extends the existing inclusions (e.g. from the global configuration). +included_optional_tools: [] + +# fixed set of tools to use as the base tool set (if non-empty), replacing Serena's default set of tools. +# This cannot be combined with non-empty excluded_tools or included_optional_tools. +fixed_tools: [] + +# list of mode names to that are always to be included in the set of active modes +# The full set of modes to be activated is base_modes + default_modes. +# If the setting is undefined, the base_modes from the global configuration (serena_config.yml) apply. +# Otherwise, this setting overrides the global configuration. +# Set this to [] to disable base modes for this project. +# Set this to a list of mode names to always include the respective modes for this project. +base_modes: + +# list of mode names that are to be activated by default. +# The full set of modes to be activated is base_modes + default_modes. +# If the setting is undefined, the default_modes from the global configuration (serena_config.yml) apply. +# Otherwise, this overrides the setting from the global configuration (serena_config.yml). +# This setting can, in turn, be overridden by CLI parameters (--mode). +default_modes: + +# initial prompt for the project. It will always be given to the LLM upon activating the project +# (contrary to the memories, which are loaded on demand). +initial_prompt: "" + +# time budget (seconds) per tool call for the retrieval of additional symbol information +# such as docstrings or parameter information. +# This overrides the corresponding setting in the global configuration; see the documentation there. +# If null or missing, use the setting from the global configuration. +symbol_info_budget: + +# list of regex patterns which, when matched, mark a memory entry as read‑only. +# Extends the list from the global configuration, merging the two lists. +read_only_memory_patterns: [] diff --git a/src/lib/pricingMethodTotals.ts b/src/lib/pricingMethodTotals.ts index 378c19e..6e1d5c7 100644 --- a/src/lib/pricingMethodTotals.ts +++ b/src/lib/pricingMethodTotals.ts @@ -614,6 +614,8 @@ const resolveScaleRows = ( return buildDefaultScaleRows(serviceId, consultCategoryFactorMap, majorFactorMap) } +// 统一生成某合同下某个咨询服务四种计费方式的存储键。 +// 优先复用 Pinia store 当前约定的 key,避免与旧版 fallback key 脱节。 export const getPricingMethodDetailDbKeys = ( contractId: string, serviceId: string | number @@ -697,6 +699,8 @@ const buildDefaultPricingMethodDetailRows = ( } } +// 强制为一组服务重建并落库默认明细行。 +// 这个方法会同时写入 Pinia 内存态和底层 KV 存储,适合“重置为默认值”场景。 export const persistDefaultPricingMethodDetailRowsForServices = async (params: { contractId: string serviceIds: Array @@ -729,6 +733,8 @@ export const persistDefaultPricingMethodDetailRowsForServices = async (params: { ) } +// 汇总单个服务的四类计费方式金额。 +// 数据读取顺序是:优先读当前 Pinia 中已加载的计费页数据,缺失时再回退到 KV 存储和合同段默认信息。 export const getPricingMethodTotalsForService = async (params: { contractId: string serviceId: string | number @@ -830,6 +836,8 @@ export const getPricingMethodTotalsForService = async (params: { } } +// 为一组服务补齐缺失的计费明细行,但不会覆盖已有用户数据。 +// 适合在首次进入计费页或新增服务后做“按需初始化”。 export const ensurePricingMethodDetailRowsForServices = async (params: { contractId: string serviceIds: Array @@ -918,6 +926,7 @@ export const ensurePricingMethodDetailRowsForServices = async (params: { ) } +// 并行汇总多个服务的计费结果,返回以 serviceId 为 key 的 Map。 export const getPricingMethodTotalsForServices = async (params: { contractId: string serviceIds: Array diff --git a/src/pinia/zxFwPricing.ts b/src/pinia/zxFwPricing.ts index 4826a0d..d071aa4 100644 --- a/src/pinia/zxFwPricing.ts +++ b/src/pinia/zxFwPricing.ts @@ -303,6 +303,8 @@ export const useZxFwPricingStore = defineStore('zxFwPricing', () => { return (servicePricingStates.value[contractId]?.[serviceId]?.[method] as ServicePricingMethodState | undefined) || null } + // 写入某合同某服务某种计费方式的明细状态。 + // 默认会同步更新 keysStore,从而触发持久化;syncKeyState=false 时只回填内存态。 const setServicePricingMethodState = ( contractIdRaw: string | number, serviceIdRaw: string | number, @@ -337,6 +339,8 @@ export const useZxFwPricingStore = defineStore('zxFwPricing', () => { return true } + // 按需加载某个服务的计费方式明细。 + // 若内存中已有且未强制刷新,直接返回;否则从 keysStore/KV 读取后回填到内存。 const loadServicePricingMethodState = async ( contractIdRaw: string | number, serviceIdRaw: string | number, @@ -362,6 +366,7 @@ export const useZxFwPricingStore = defineStore('zxFwPricing', () => { return getServicePricingMethodState(contractId, serviceId, method) } + // 删除单个服务某种计费方式的状态,并同步清理对应持久化 key。 const removeServicePricingMethodState = ( contractIdRaw: string | number, serviceIdRaw: string | number, @@ -377,6 +382,7 @@ export const useZxFwPricingStore = defineStore('zxFwPricing', () => { return had } + // 暴露给外部使用的单个计费方式存储键,便于兼容旧逻辑直接读写底层数据。 const getServicePricingStorageKey = ( contractIdRaw: string | number, serviceIdRaw: string | number, @@ -388,6 +394,7 @@ export const useZxFwPricingStore = defineStore('zxFwPricing', () => { return serviceMethodDbKeyOf(contractId, serviceId, method) } + // 返回某个服务全部计费方式对应的存储键集合,常用于批量清理或导出。 const getServicePricingStorageKeys = (contractIdRaw: string | number, serviceIdRaw: string | number) => { const contractId = toKey(contractIdRaw) const serviceId = toServiceKey(serviceIdRaw) @@ -547,6 +554,7 @@ export const useZxFwPricingStore = defineStore('zxFwPricing', () => { const getKeyVersion = (keyRaw: string | number) => keysStore.getKeyVersion(keyRaw) + // 对外返回合同咨询服务状态的深拷贝,避免组件直接改写 store 内部引用。 const getContractState = (contractIdRaw: string | number) => { const contractId = toKey(contractIdRaw) if (!contractId) return null @@ -554,6 +562,8 @@ export const useZxFwPricingStore = defineStore('zxFwPricing', () => { return data ? cloneState(data) : null } + // 加载合同维度的咨询服务汇总状态。 + // 同一合同在并发场景下会复用同一个加载任务,避免重复读取 KV。 const loadContract = async (contractIdRaw: string | number, force = false) => { const contractId = toKey(contractIdRaw) if (!contractId) return null @@ -589,6 +599,8 @@ export const useZxFwPricingStore = defineStore('zxFwPricing', () => { } } + // 整体替换某个合同的咨询服务状态。 + // 入口会先标准化数据并做快照比较,只有真实变化时才递增版本号。 const setContractState = async (contractIdRaw: string | number, state: ZxFwState) => { const contractId = toKey(contractIdRaw) if (!contractId) return false @@ -601,6 +613,8 @@ export const useZxFwPricingStore = defineStore('zxFwPricing', () => { return true } + // 只更新某个服务行上的单个汇总字段,适合计费页回写 investScale/landScale/workload/hourly。 + // 这里不会额外重算其它派生字段,调用方需要自行决定是否联动更新 subtotal/finalFee。 const updatePricingField = async (params: { contractId: string serviceId: string | number @@ -661,6 +675,7 @@ export const useZxFwPricingStore = defineStore('zxFwPricing', () => { return hasValid ? round3(sum) : null } + // 清理合同维度的内存态、版本号以及该合同下所有相关持久化键。 const removeContractData = (contractIdRaw: string | number) => { const contractId = toKey(contractIdRaw) if (!contractId) return false