diff --git a/apps/jingrow/frontend/src/core/components/FilterBar.vue b/apps/jingrow/frontend/src/core/components/FilterBar.vue index 31174b4..23a7482 100644 --- a/apps/jingrow/frontend/src/core/components/FilterBar.vue +++ b/apps/jingrow/frontend/src/core/components/FilterBar.vue @@ -169,7 +169,6 @@ import { ref, computed, watch, onMounted, onUnmounted } from 'vue' import { NInput, NSelect, NInputNumber, NDatePicker } from 'naive-ui' import { t } from '@/shared/i18n' import axios from 'axios' -import { get_session_api_headers } from '@/shared/api/auth' import { getRecords } from '@/shared/api/common' interface FilterField { @@ -349,10 +348,7 @@ async function loadLinkDisplayValue(field: FilterField) { } // 获取记录的title_field值 - const response = await axios.get(`/api/data/${encodeURIComponent(field.options)}/${encodeURIComponent(currentValue)}`, { - headers: get_session_api_headers(), - withCredentials: true - }) + const response = await axios.get(`/api/data/${encodeURIComponent(field.options)}/${encodeURIComponent(currentValue)}`) const recordData = response.data?.data || {} const titleValue = recordData[titleField] || currentValue @@ -382,10 +378,7 @@ async function getLinkPageTypeConfig(pagetype: string) { } try { - const response = await axios.get(`/api/data/PageType/${encodeURIComponent(pagetype)}`, { - headers: get_session_api_headers(), - withCredentials: true - }) + const response = await axios.get(`/api/data/PageType/${encodeURIComponent(pagetype)}`) const config = response.data?.data || {} linkDropdownStates.value[fieldName].pageTypeConfig = config diff --git a/apps/jingrow/frontend/src/core/pagetype/default.vue b/apps/jingrow/frontend/src/core/pagetype/default.vue index f77d058..3084386 100644 --- a/apps/jingrow/frontend/src/core/pagetype/default.vue +++ b/apps/jingrow/frontend/src/core/pagetype/default.vue @@ -283,7 +283,6 @@ const TagSection = defineAsyncComponent(async () => { }) import axios from 'axios' import { t } from '@/shared/i18n' -import { get_session_api_headers } from '@/shared/api/auth' import { updateRecord, getRecord, getRecordAttachments, deleteAttachment, uploadAttachment, deleteRecords } from '@/shared/api/common' import { downloadImageToLocal } from '@/shared/api/common' import { usePageTypeSlug } from '@/shared/utils/slug' @@ -822,7 +821,7 @@ async function loadMeta() { loading.value = true try { const url = `/api/data/PageType/${encodeURIComponent(entity.value)}` - const res = await axios.get(url, { headers: get_session_api_headers(), withCredentials: true }) + const res = await axios.get(url) const data = res.data?.data metaFields.value = data?.fields || [] @@ -1008,7 +1007,7 @@ async function handleSave() { if (id.value.startsWith('new-')) { recordData.__temporary_name = id.value } - const response = await axios.post(url, recordData, { headers: get_session_api_headers(), withCredentials: true }) + const response = await axios.post(url, recordData) message.success(t('Created successfully')) // 保存成功更新快照 try { originalRecord.value = JSON.parse(JSON.stringify(record.value)) } catch { originalRecord.value = { ...record.value } } diff --git a/apps/jingrow/frontend/src/core/pagetype/default_list.vue b/apps/jingrow/frontend/src/core/pagetype/default_list.vue index 239f91f..a8707e9 100644 --- a/apps/jingrow/frontend/src/core/pagetype/default_list.vue +++ b/apps/jingrow/frontend/src/core/pagetype/default_list.vue @@ -412,7 +412,6 @@ import { NPagination, NModal, NInput, NButton, NCheckbox, NSelect, useMessage, u import { Icon } from '@iconify/vue' import axios from 'axios' import { t } from '@/shared/i18n' -import { get_session_api_headers } from '@/shared/api/auth' import { usePageTypeSlug } from '@/shared/utils/slug' import { isSinglePageType } from '@/shared/utils/pagetype' import DefaultSingle from '@/core/pagetype/default_single.vue' @@ -723,7 +722,7 @@ async function loadMeta() { loading.value = true try { const url = `/api/data/PageType/${encodeURIComponent(entity.value)}` - const res = await axios.get(url, { headers: get_session_api_headers(), withCredentials: true }) + const res = await axios.get(url) const data = res.data?.data || {} metaFields.value = data.fields || [] pageMeta.value = data // 保存完整的pageMeta,包含image_field等配置 @@ -748,10 +747,7 @@ async function getPageTypeConfig(pagetype: string) { } try { - const response = await axios.get(`/api/data/PageType/${encodeURIComponent(pagetype)}`, { - headers: get_session_api_headers(), - withCredentials: true - }) + const response = await axios.get(`/api/data/PageType/${encodeURIComponent(pagetype)}`) const config = response.data?.data || {} pageTypeConfigCache.value[pagetype] = config @@ -821,9 +817,7 @@ async function preloadLinkTitles() { fields: JSON.stringify(fields), filters: JSON.stringify(filters), limit_page_length: namesToLoad.length - }, - headers: get_session_api_headers(), - withCredentials: true + } }) // 缓存结果(使用LRU策略) @@ -945,9 +939,7 @@ async function loadData() { fields: JSON.stringify(['name']), filters: JSON.stringify(searchFilters), limit_page_length: 100 // 限制最多100条,避免性能问题 - }, - headers: get_session_api_headers(), - withCredentials: true + } }) const matchedRecords = searchResult.data?.data || [] @@ -971,9 +963,7 @@ async function loadData() { fields: JSON.stringify(['name']), filters: JSON.stringify(searchFilters), limit_page_length: 100 - }, - headers: get_session_api_headers(), - withCredentials: true + } }) const matchedRecords = searchResult.data?.data || [] @@ -1006,8 +996,7 @@ async function loadData() { } const res = await axios.get(listUrl, { - params, - headers: get_session_api_headers(), withCredentials: true + params }) rows.value = res.data?.data || [] // 后端可能没有返回 total,我们基于第一次请求的数量来估计 @@ -1213,9 +1202,7 @@ async function loadModules() { fields: JSON.stringify(['name']), order_by: 'name asc', limit_page_length: 1000 - }, - headers: get_session_api_headers(), - withCredentials: true + } }) const modules = response.data?.data || [] @@ -1242,9 +1229,7 @@ async function loadPackages() { fields: JSON.stringify(['name']), order_by: 'name asc', limit_page_length: 1000 - }, - headers: get_session_api_headers(), - withCredentials: true + } }) const packages = response.data?.data || [] @@ -1309,13 +1294,7 @@ async function handleCreatePageType() { console.log('[CreatePageType] 创建数据:', createData) const res = await axios.post( - `/api/data/PageType`, - createData, - { - headers: get_session_api_headers(), - withCredentials: true - } - ) + `/api/data/PageType`, createData) console.log('[CreatePageType] API响应:', res) console.log('[CreatePageType] 响应data:', res.data) diff --git a/apps/jingrow/frontend/src/core/pagetype/default_single.vue b/apps/jingrow/frontend/src/core/pagetype/default_single.vue index 26a92d6..0c44d01 100644 --- a/apps/jingrow/frontend/src/core/pagetype/default_single.vue +++ b/apps/jingrow/frontend/src/core/pagetype/default_single.vue @@ -420,7 +420,6 @@ import JeditorControl from '@/core/pagetype/form/controls/Jeditor.vue' import { Icon } from '@iconify/vue' import axios from 'axios' import { t } from '@/shared/i18n' -import { get_session_api_headers } from '@/shared/api/auth' import { usePageTypeSlug } from '@/shared/utils/slug' import { getSinglePageData, saveSinglePageData } from '@/shared/utils/pagetype' @@ -809,7 +808,7 @@ async function loadMeta() { loading.value = true try { const url = `/api/data/PageType/${encodeURIComponent(entity.value)}` - const res = await axios.get(url, { headers: get_session_api_headers(), withCredentials: true }) + const res = await axios.get(url) const data = res.data?.data metaFields.value = data?.fields || [] diff --git a/apps/jingrow/frontend/src/core/pagetype/form/controls/Link.vue b/apps/jingrow/frontend/src/core/pagetype/form/controls/Link.vue index 0de36f9..4992854 100644 --- a/apps/jingrow/frontend/src/core/pagetype/form/controls/Link.vue +++ b/apps/jingrow/frontend/src/core/pagetype/form/controls/Link.vue @@ -5,7 +5,6 @@ import { Icon } from '@iconify/vue' import { getRecords } from '@/shared/api/common' import { pageTypeToSlug } from '@/shared/utils/slug' import axios from 'axios' -import { get_session_api_headers } from '@/shared/api/auth' import { t } from '@/shared/i18n' const props = defineProps<{ df: any; record: Record; canEdit: boolean; ctx: any }>() @@ -59,10 +58,7 @@ async function getPageTypeConfig(pagetype: string) { } try { - const response = await axios.get(`/api/data/PageType/${encodeURIComponent(pagetype)}`, { - headers: get_session_api_headers(), - withCredentials: true - }) + const response = await axios.get(`/api/data/PageType/${encodeURIComponent(pagetype)}`) const config = response.data?.data || {} pageTypeConfig.value[pagetype] = config @@ -102,10 +98,7 @@ async function getRecordTitle(pagetype: string, recordName: string) { } // 获取记录数据 - const response = await axios.get(`/api/data/${encodeURIComponent(pagetype)}/${encodeURIComponent(recordName)}`, { - headers: get_session_api_headers(), - withCredentials: true - }) + const response = await axios.get(`/api/data/${encodeURIComponent(pagetype)}/${encodeURIComponent(recordName)}`) const recordData = response.data?.data || {} const titleValue = recordData[titleField] || recordName diff --git a/apps/jingrow/frontend/src/core/pagetype/form/controls/Table.vue b/apps/jingrow/frontend/src/core/pagetype/form/controls/Table.vue index 68a654a..f4ffdc4 100644 --- a/apps/jingrow/frontend/src/core/pagetype/form/controls/Table.vue +++ b/apps/jingrow/frontend/src/core/pagetype/form/controls/Table.vue @@ -4,7 +4,6 @@ import { NModal, NButton, NSpace, NIcon, NTag } from 'naive-ui' import FieldRenderer from '@/core/pagetype/form/FieldRenderer.vue' import { Icon } from '@iconify/vue' import axios from 'axios' -import { get_session_api_headers } from '@/shared/api/auth' const props = defineProps<{ df: any; @@ -220,7 +219,7 @@ async function loadChildMeta() { if (!pagetype) return loading.value = true try { - const res = await axios.get(`/api/data/PageType/${encodeURIComponent(pagetype)}` , { headers: get_session_api_headers(), withCredentials: true }) + const res = await axios.get(`/api/data/PageType/${encodeURIComponent(pagetype)}` ) const fields: Field[] = res.data?.data?.fields || [] childFields.value = fields } finally { diff --git a/apps/jingrow/frontend/src/shared/api/auth.ts b/apps/jingrow/frontend/src/shared/api/auth.ts index 813db66..d8e8490 100644 --- a/apps/jingrow/frontend/src/shared/api/auth.ts +++ b/apps/jingrow/frontend/src/shared/api/auth.ts @@ -187,11 +187,3 @@ export const signupApi = async (data: SignupRequest): Promise => } } } - -// 仅使用会话Cookie的最小鉴权头部(不影响现有API Key逻辑) -export function get_session_api_headers() { - return { - 'Content-Type': 'application/json', - 'Accept': 'application/json' - } -} diff --git a/apps/jingrow/frontend/src/shared/api/common.ts b/apps/jingrow/frontend/src/shared/api/common.ts index 4b47484..78b9b9b 100644 --- a/apps/jingrow/frontend/src/shared/api/common.ts +++ b/apps/jingrow/frontend/src/shared/api/common.ts @@ -1,5 +1,4 @@ import axios from 'axios' -import { get_session_api_headers } from './auth' // 统一使用相对路径,通过 Vite 代理转发到后端 @@ -17,8 +16,6 @@ export const deleteRecords = async (pagetype: string, names: string[]): Promise< names: names }, { - headers: get_session_api_headers(), - withCredentials: true, validateStatus: (status) => status === 200 || status === 207 // 允许207状态码 } ) @@ -40,13 +37,7 @@ export const deleteRecords = async (pagetype: string, names: string[]): Promise< export const createRecord = async (pagetype: string, data: Record): Promise<{ success: boolean; data?: any; message?: string }> => { try { const response = await axios.post( - `/api/data/${pagetype}`, - data, - { - headers: get_session_api_headers(), - withCredentials: true - } - ) + `/api/data/${pagetype}`, data) const message = response.data?.message return { success: true, data: message || response.data, message: 'Created successfully' } @@ -59,13 +50,7 @@ export const createRecord = async (pagetype: string, data: Record): export const updateRecord = async (pagetype: string, name: string, data: Record): Promise<{ success: boolean; data?: any; message?: string }> => { try { const response = await axios.put( - `/api/data/${pagetype}/${name}`, - data, - { - headers: get_session_api_headers(), - withCredentials: true - } - ) + `/api/data/${pagetype}/${name}`, data) const message = response.data?.message return { success: true, data: message || response.data, message: 'Updated successfully' } @@ -78,12 +63,7 @@ export const updateRecord = async (pagetype: string, name: string, data: Record< export const getRecord = async (pagetype: string, name: string): Promise<{ success: boolean; data?: any; message?: string }> => { try { const response = await axios.get( - `/api/data/${pagetype}/${name}`, - { - headers: get_session_api_headers(), - withCredentials: true - } - ) + `/api/data/${pagetype}/${name}`) return { success: true, data: response.data.data } } catch (error: any) { return { success: false, message: error.response?.data?.message || error.message || '获取失败' } @@ -102,9 +82,7 @@ export const getRecordAttachments = async (pagetype: string, name: string): Prom attached_to_name: name }), fields: JSON.stringify(['name', 'file_name', 'file_url', 'is_private']) - }, - headers: get_session_api_headers(), - withCredentials: true + } } ) return { success: true, data: response.data.data || [] } @@ -133,10 +111,8 @@ export const uploadAttachment = async ( formData, { headers: { - ...get_session_api_headers(), 'Content-Type': 'multipart/form-data' - }, - withCredentials: true + } } ) @@ -153,12 +129,7 @@ export const uploadAttachment = async ( export const deleteAttachment = async (attachmentName: string): Promise<{ success: boolean; message?: string }> => { try { await axios.delete( - `/api/data/File/${attachmentName}`, - { - headers: get_session_api_headers(), - withCredentials: true - } - ) + `/api/data/File/${attachmentName}`) return { success: true, message: '附件删除成功' } } catch (error: any) { return { success: false, message: error.response?.data?.message || error.message || '删除附件失败' } @@ -179,9 +150,7 @@ export const getCount = async (pagetype: string): Promise<{ success: boolean; co { params: { pagetype: pagetype - }, - headers: get_session_api_headers(), - withCredentials: true + } } ) @@ -200,12 +169,7 @@ export const getCount = async (pagetype: string): Promise<{ success: boolean; co export const getLocalJobCount = async (): Promise<{ success: boolean; count?: number; message?: string }> => { try { const response = await axios.get( - `/jingrow/local-job-count`, - { - headers: get_session_api_headers(), - withCredentials: true - } - ) + `/jingrow/local-job-count`) const count = response.data?.count || 0 return { @@ -234,9 +198,7 @@ export const getRecords = async (pagetype: string, filters: any[] = [], fields: order_by: orderBy, limit_start: limitStart, limit_page_length: limitPageLength - }, - headers: get_session_api_headers(), - withCredentials: true + } } ) @@ -272,8 +234,6 @@ export const downloadImageToLocal = async ( filename: filename }, { - headers: get_session_api_headers(), - withCredentials: true, timeout: 30000 } ) @@ -325,10 +285,8 @@ export const uploadFileToJingrow = async ( formData, { headers: { - ...get_session_api_headers(), 'Content-Type': 'multipart/form-data' }, - withCredentials: true, timeout: 30000 } ) diff --git a/apps/jingrow/frontend/src/shared/api/embedding.ts b/apps/jingrow/frontend/src/shared/api/embedding.ts index 97baef4..c946777 100644 --- a/apps/jingrow/frontend/src/shared/api/embedding.ts +++ b/apps/jingrow/frontend/src/shared/api/embedding.ts @@ -1,17 +1,10 @@ import axios from 'axios' -import { get_session_api_headers } from './auth' // 内部函数:调用文本转向量API const callEmbeddingApi = async (texts: string[]) => { try { const response = await axios.post( - `/jingrow/embedding/batch`, - { texts }, - { - headers: get_session_api_headers(), - withCredentials: true - } - ) + `/jingrow/embedding/batch`, { texts }) return { success: true, @@ -43,8 +36,6 @@ const searchVectors = async ( score_threshold: scoreThreshold }, { - headers: get_session_api_headers(), - withCredentials: true } ) diff --git a/apps/jingrow/frontend/src/shared/api/nodes.ts b/apps/jingrow/frontend/src/shared/api/nodes.ts index 2672de6..7effe10 100644 --- a/apps/jingrow/frontend/src/shared/api/nodes.ts +++ b/apps/jingrow/frontend/src/shared/api/nodes.ts @@ -1,5 +1,4 @@ import axios from 'axios' -import { get_session_api_headers } from './auth' // 统一使用相对路径,通过 Vite 代理转发到后端 @@ -7,9 +6,7 @@ import { get_session_api_headers } from './auth' export const getNodeSchemaFields = async (nodeType: string): Promise => { try { const response = await axios.get( - `/jingrow/node/schema-fields/${encodeURIComponent(nodeType)}`, - { headers: get_session_api_headers(), withCredentials: true } - ) + `/jingrow/node/schema-fields/${encodeURIComponent(nodeType)}`) return response.data?.fields || [] } catch (error) { console.error('获取节点Schema字段失败:', error) @@ -21,10 +18,7 @@ export const getNodeSchemaFields = async (nodeType: string): Promise => { export const importLocalNodes = async (): Promise<{ success: boolean; matched: number; imported: number; skipped_existing: number; errors?: string[] }> => { try { const response = await axios.post( - `/jingrow/node/import-local`, - {}, - { headers: get_session_api_headers(), withCredentials: true } - ) + `/jingrow/node/import-local`, {}) return response.data } catch (error) { console.error('导入本地节点失败:', error) @@ -38,9 +32,7 @@ export const packageNode = async (nodeType: string): Promise<{ blob: Blob; filen const response = await axios.post( `/jingrow/node/package/${encodeURIComponent(nodeType)}`, {}, - { - headers: get_session_api_headers(), - withCredentials: true, + { responseType: 'blob' } ) @@ -96,10 +88,8 @@ export const publishNodeToMarketplace = async (data: { formData, { headers: { - ...get_session_api_headers(), 'Content-Type': 'multipart/form-data' - }, - withCredentials: true + } } ) return response.data diff --git a/apps/jingrow/frontend/src/shared/api/system.ts b/apps/jingrow/frontend/src/shared/api/system.ts index ca63d4f..a4ac1a5 100644 --- a/apps/jingrow/frontend/src/shared/api/system.ts +++ b/apps/jingrow/frontend/src/shared/api/system.ts @@ -1,5 +1,4 @@ import axios from 'axios' -import { get_session_api_headers } from './auth' export interface EnvironmentConfig { jingrow_server_url: string @@ -32,12 +31,7 @@ export interface EnvironmentConfig { export const getEnvironmentConfig = async (): Promise<{ success: boolean; data?: EnvironmentConfig; message?: string }> => { try { const response = await axios.get( - `/jingrow/system/environment-config`, - { - headers: get_session_api_headers(), - withCredentials: true - } - ) + `/jingrow/system/environment-config`) if (response.data?.success) { return { success: true, data: response.data.data } @@ -58,13 +52,7 @@ export const getEnvironmentConfig = async (): Promise<{ success: boolean; data?: export const updateEnvironmentConfig = async (config: Partial): Promise<{ success: boolean; message?: string }> => { try { const response = await axios.post( - `/jingrow/system/environment-config`, - config, - { - headers: get_session_api_headers(), - withCredentials: true - } - ) + `/jingrow/system/environment-config`, config) if (response.data?.success) { return { success: true, message: response.data.message || '环境配置已更新' } @@ -85,13 +73,7 @@ export const updateEnvironmentConfig = async (config: Partial export const restartEnvironment = async (): Promise<{ success: boolean; message?: string }> => { try { const response = await axios.post( - `/jingrow/system/restart-environment`, - {}, - { - headers: get_session_api_headers(), - withCredentials: true - } - ) + `/jingrow/system/restart-environment`, {}) if (response.data?.success) { return { success: true, message: response.data.message || '环境重启请求已提交' } diff --git a/apps/jingrow/frontend/src/shared/stores/tools.ts b/apps/jingrow/frontend/src/shared/stores/tools.ts index dcefce4..0a3296c 100644 --- a/apps/jingrow/frontend/src/shared/stores/tools.ts +++ b/apps/jingrow/frontend/src/shared/stores/tools.ts @@ -4,7 +4,6 @@ import type { Router } from 'vue-router' import axios from 'axios' import { t } from '../i18n' import { registerToolRoute, unregisterToolRoute, registerAllToolRoutes, ensureToolRoutes } from '../utils/dynamicRoutes' -import { get_session_api_headers } from '../api/auth' export interface Tool { id: string @@ -175,8 +174,7 @@ export const useToolsStore = defineStore('tools', () => { try { await axios.post(`/jingrow/uninstall-tool/${toolName}`, {}, { headers: { - ...get_session_api_headers() - } + } }) } catch (error: any) { console.error('删除工具文件失败:', error.response?.data || error.message || '未知错误') diff --git a/apps/jingrow/frontend/src/shared/utils/pagetype.ts b/apps/jingrow/frontend/src/shared/utils/pagetype.ts index 8918ad2..8603444 100644 --- a/apps/jingrow/frontend/src/shared/utils/pagetype.ts +++ b/apps/jingrow/frontend/src/shared/utils/pagetype.ts @@ -1,5 +1,4 @@ import axios from 'axios' -import { get_session_api_headers } from '../api/auth' /** * 检查 pagetype 是否为单页模式 @@ -9,10 +8,7 @@ import { get_session_api_headers } from '../api/auth' export async function isSinglePageType(entity: string): Promise { try { const url = `/api/data/PageType/${encodeURIComponent(entity)}` - const res = await axios.get(url, { - headers: get_session_api_headers(), - withCredentials: true - }) + const res = await axios.get(url) const data = res.data?.data // 检查 issingle 字段,如果为 1 或 true 则认为是单页模式 @@ -41,10 +37,7 @@ export async function getPageTypeRouteName(entity: string): Promise { export async function getSinglePageData(pagetype: string): Promise<{ success: boolean; data?: any; message?: string }> { try { const url = `/api/data/${encodeURIComponent(pagetype)}/${encodeURIComponent(pagetype)}` - const res = await axios.get(url, { - headers: get_session_api_headers(), - withCredentials: true - }) + const res = await axios.get(url) if (res.data?.data) { return { @@ -75,10 +68,7 @@ export async function getSinglePageData(pagetype: string): Promise<{ success: bo export async function saveSinglePageData(pagetype: string, data: any): Promise<{ success: boolean; message?: string }> { try { const url = `/api/data/${encodeURIComponent(pagetype)}/${encodeURIComponent(pagetype)}` - await axios.put(url, data, { - headers: get_session_api_headers(), - withCredentials: true - }) + await axios.put(url, data) return { success: true diff --git a/apps/jingrow/frontend/src/views/dev/AgentDetail.vue b/apps/jingrow/frontend/src/views/dev/AgentDetail.vue index 2e0d662..6088f26 100644 --- a/apps/jingrow/frontend/src/views/dev/AgentDetail.vue +++ b/apps/jingrow/frontend/src/views/dev/AgentDetail.vue @@ -128,7 +128,6 @@