From b0a145fd5bc954aa053053fe37da9a32d90921c7 Mon Sep 17 00:00:00 2001 From: "Apple\\Apple" Date: Wed, 4 Jun 2025 00:01:41 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(api):=20resolve=20missing=20?= =?UTF-8?q?imports=20in=20buildApiPayload=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix ReferenceError caused by undefined `isValidMessage` and `MESSAGE_ROLES` in the buildApiPayload function within api.js. Changes: - Add missing `isValidMessage` import from utils.js - Add missing `MESSAGE_ROLES` import from playground constants - Consolidate duplicate `formatMessageForAPI` import - Clean up import statements organization Resolves: ReferenceError: isValidMessage is not defined at buildApiPayload (api.js:39:13) --- web/src/helpers/api.js | 4 ++-- web/src/helpers/render.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/web/src/helpers/api.js b/web/src/helpers/api.js index d58487b5..73708b04 100644 --- a/web/src/helpers/api.js +++ b/web/src/helpers/api.js @@ -1,6 +1,6 @@ -import { getUserIdFromLocalStorage, showError } from './utils'; +import { getUserIdFromLocalStorage, showError, formatMessageForAPI, isValidMessage } from './utils'; import axios from 'axios'; -import { formatMessageForAPI } from './index.js'; +import { MESSAGE_ROLES } from '../constants/playground.constants'; export let API = axios.create({ baseURL: import.meta.env.VITE_REACT_APP_SERVER_URL diff --git a/web/src/helpers/render.js b/web/src/helpers/render.js index 862dd8eb..c8302feb 100644 --- a/web/src/helpers/render.js +++ b/web/src/helpers/render.js @@ -1,6 +1,6 @@ import i18next from 'i18next'; import { Modal, Tag, Typography } from '@douyinfe/semi-ui'; -import { copy, isMobile, showSuccess } from './index.js'; +import { copy, isMobile, showSuccess } from './utils'; import { visit } from 'unist-util-visit'; export function renderText(text, limit) {