From 9ee71902c1527a2d2654a3aa2fd1e5e1f4173450 Mon Sep 17 00:00:00 2001 From: wangxiaolei Date: Tue, 13 Jan 2026 11:51:15 +0800 Subject: [PATCH 1/3] fix: fix formatNumber accuracy (#30877) --- web/utils/format.spec.ts | 22 ++++++++++++++++++++++ web/utils/format.ts | 30 +++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/web/utils/format.spec.ts b/web/utils/format.spec.ts index 0fde0ccbe8..3a1709dbdc 100644 --- a/web/utils/format.spec.ts +++ b/web/utils/format.spec.ts @@ -19,6 +19,28 @@ describe('formatNumber', () => { it('should correctly handle empty input', () => { expect(formatNumber('')).toBe('') }) + it('should format very small numbers without scientific notation', () => { + expect(formatNumber(0.0000008)).toBe('0.0000008') + expect(formatNumber(0.0000001)).toBe('0.0000001') + expect(formatNumber(0.000001)).toBe('0.000001') + expect(formatNumber(0.00001)).toBe('0.00001') + }) + it('should format negative small numbers without scientific notation', () => { + expect(formatNumber(-0.0000008)).toBe('-0.0000008') + expect(formatNumber(-0.0000001)).toBe('-0.0000001') + }) + it('should handle small numbers from string input', () => { + expect(formatNumber('0.0000008')).toBe('0.0000008') + expect(formatNumber('8E-7')).toBe('0.0000008') + expect(formatNumber('1e-7')).toBe('0.0000001') + }) + it('should handle small numbers with multi-digit mantissa in scientific notation', () => { + expect(formatNumber(1.23e-7)).toBe('0.000000123') + expect(formatNumber(1.234e-7)).toBe('0.0000001234') + expect(formatNumber(12.34e-7)).toBe('0.000001234') + expect(formatNumber(0.0001234)).toBe('0.0001234') + expect(formatNumber('1.23e-7')).toBe('0.000000123') + }) }) describe('formatFileSize', () => { it('should return the input if it is falsy', () => { diff --git a/web/utils/format.ts b/web/utils/format.ts index d087d690a2..0c81b339a3 100644 --- a/web/utils/format.ts +++ b/web/utils/format.ts @@ -26,11 +26,39 @@ import 'dayjs/locale/zh-tw' * Formats a number with comma separators. * @example formatNumber(1234567) will return '1,234,567' * @example formatNumber(1234567.89) will return '1,234,567.89' + * @example formatNumber(0.0000008) will return '0.0000008' */ export const formatNumber = (num: number | string) => { if (!num) return num - const parts = num.toString().split('.') + const n = typeof num === 'string' ? Number(num) : num + + let numStr: string + + // Force fixed decimal for small numbers to avoid scientific notation + if (Math.abs(n) < 0.001 && n !== 0) { + const str = n.toString() + const match = str.match(/e-(\d+)$/) + let precision: number + if (match) { + // Scientific notation: precision is exponent + decimal digits in mantissa + const exponent = Number.parseInt(match[1], 10) + const mantissa = str.split('e')[0] + const mantissaDecimalPart = mantissa.split('.')[1] + precision = exponent + (mantissaDecimalPart?.length || 0) + } + else { + // Decimal notation: count decimal places + const decimalPart = str.split('.')[1] + precision = decimalPart?.length || 0 + } + numStr = n.toFixed(precision) + } + else { + numStr = n.toString() + } + + const parts = numStr.split('.') parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',') return parts.join('.') } From 8f43629cd84f4cebf47ba84d6d018825853483ec Mon Sep 17 00:00:00 2001 From: Coding On Star <447357187@qq.com> Date: Tue, 13 Jan 2026 12:26:50 +0800 Subject: [PATCH 2/3] fix(amplitude): update sessionReplaySampleRate default value to 0.5 (#30880) Co-authored-by: CodingOnStar --- web/app/components/base/amplitude/AmplitudeProvider.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/app/components/base/amplitude/AmplitudeProvider.tsx b/web/app/components/base/amplitude/AmplitudeProvider.tsx index 87ef516835..0f083a4a7d 100644 --- a/web/app/components/base/amplitude/AmplitudeProvider.tsx +++ b/web/app/components/base/amplitude/AmplitudeProvider.tsx @@ -54,7 +54,7 @@ const pageNameEnrichmentPlugin = (): amplitude.Types.EnrichmentPlugin => { } const AmplitudeProvider: FC = ({ - sessionReplaySampleRate = 1, + sessionReplaySampleRate = 0.5, }) => { useEffect(() => { // Only enable in Saas edition with valid API key From 9be863fefa03456508f7abd605d5cb78ca5a5bb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=86=E8=90=8C=E9=97=B7=E6=B2=B9=E7=93=B6?= <253605712@qq.com> Date: Tue, 13 Jan 2026 12:46:33 +0800 Subject: [PATCH 3/3] fix: missing content if assistant message with tool_calls (#30083) Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- api/core/agent/fc_agent_runner.py | 4 +--- api/core/model_runtime/entities/message_entities.py | 5 +---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/api/core/agent/fc_agent_runner.py b/api/core/agent/fc_agent_runner.py index 68d14ad027..7c5c9136a7 100644 --- a/api/core/agent/fc_agent_runner.py +++ b/api/core/agent/fc_agent_runner.py @@ -188,7 +188,7 @@ class FunctionCallAgentRunner(BaseAgentRunner): ), ) - assistant_message = AssistantPromptMessage(content="", tool_calls=[]) + assistant_message = AssistantPromptMessage(content=response, tool_calls=[]) if tool_calls: assistant_message.tool_calls = [ AssistantPromptMessage.ToolCall( @@ -200,8 +200,6 @@ class FunctionCallAgentRunner(BaseAgentRunner): ) for tool_call in tool_calls ] - else: - assistant_message.content = response self._current_thoughts.append(assistant_message) diff --git a/api/core/model_runtime/entities/message_entities.py b/api/core/model_runtime/entities/message_entities.py index 3ac83b4c96..9e46d72893 100644 --- a/api/core/model_runtime/entities/message_entities.py +++ b/api/core/model_runtime/entities/message_entities.py @@ -251,10 +251,7 @@ class AssistantPromptMessage(PromptMessage): :return: True if prompt message is empty, False otherwise """ - if not super().is_empty() and not self.tool_calls: - return False - - return True + return super().is_empty() and not self.tool_calls class SystemPromptMessage(PromptMessage):