格式化代码
This commit is contained in:
parent
407e22aabe
commit
46dc09ffe8
|
|
@ -1,12 +1,7 @@
|
|||
package com.electromagnetic.industry.software.manage.config;
|
||||
|
||||
import org.springframework.ai.chat.client.advisor.MessageChatMemoryAdvisor;
|
||||
import org.springframework.ai.embedding.EmbeddingModel;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class AiAdvisor {
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import com.electromagnetic.industry.software.manage.pojo.req.QueryDTO;
|
|||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.ai.chat.client.ChatClient;
|
||||
import org.springframework.ai.chat.client.advisor.MessageChatMemoryAdvisor;
|
||||
import org.springframework.ai.chat.messages.UserMessage;
|
||||
import org.springframework.ai.chat.model.ChatResponse;
|
||||
import org.springframework.ai.chat.prompt.Prompt;
|
||||
|
|
@ -53,7 +52,7 @@ public class ChatService {
|
|||
private VectorStore vectorStore;
|
||||
@Resource
|
||||
private OllamaChatModel model;
|
||||
// @Resource
|
||||
// @Resource
|
||||
// private MessageChatMemoryAdvisor messageChatMemoryAdvisor;
|
||||
@Resource
|
||||
private AiFileUploadRecordMapper aiFileUploadRecordMapper;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package com.electromagnetic.industry.software.manage.service.serviceimpl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.electromagnetic.industry.software.common.enums.DataOwnEnum;
|
||||
import com.electromagnetic.industry.software.common.enums.EffectFlagEnum;
|
||||
import com.electromagnetic.industry.software.common.enums.EleDataStatusEnum;
|
||||
|
|
@ -92,10 +94,13 @@ public class PermissionServiceImpl implements PermissionService {
|
|||
.eq(RolePermission::getPermissionCode, FilePermission.VIEW.getCode());
|
||||
List<String> ids = rolePermissionService.listObjs(queryWrapper1).stream().map(Object::toString).toList();
|
||||
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
Set<String> result = new HashSet<>();
|
||||
// 把父亲节点加上
|
||||
for (String id : ids) {
|
||||
EdFileInfo file = edFileInfoMapper.selectById(id);
|
||||
List<EdFileInfo> edFileInfos = edFileInfoMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class).in(EdFileInfo::getId, ids));
|
||||
for (EdFileInfo file : edFileInfos) {
|
||||
String[] parentIds = file.getFilePath().split("_");
|
||||
result.addAll(Arrays.asList(parentIds));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,7 +166,8 @@
|
|||
where r.id in (select ur.role_id
|
||||
from ed_users u
|
||||
left join ed_user_role ur on u.id = ur.user_id
|
||||
where u.id = #{userId} and ur.effect_flag = 1)
|
||||
where u.id = #{userId}
|
||||
and ur.effect_flag = 1)
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -1 +1,5 @@
|
|||
function r(o){throw new Error('Could not dynamically require "'+o+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}export{r as c};
|
||||
function r(o) {
|
||||
throw new Error('Could not dynamically require "' + o + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')
|
||||
}
|
||||
|
||||
export {r as c};
|
||||
|
|
|
|||
|
|
@ -1 +1,6 @@
|
|||
const s=(t,r)=>{const o=t.__vccOpts||t;for(const[c,e]of r)o[c]=e;return o};export{s as _};
|
||||
const s = (t, r) => {
|
||||
const o = t.__vccOpts || t;
|
||||
for (const [c, e] of r) o[c] = e;
|
||||
return o
|
||||
};
|
||||
export {s as _};
|
||||
|
|
|
|||
|
|
@ -1 +1,7 @@
|
|||
.backup-setting-management[data-v-592b576d]{background-color:#fff;padding:16px 24px;display:flex;flex-direction:column;height:100%}
|
||||
.backup-setting-management[data-v-592b576d] {
|
||||
background-color: #fff;
|
||||
padding: 16px 24px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1,7 @@
|
|||
.file-type-management[data-v-4e509c99]{background-color:#fff;padding:16px 24px;display:flex;flex-direction:column;height:100%}
|
||||
.file-type-management[data-v-4e509c99] {
|
||||
background-color: #fff;
|
||||
padding: 16px 24px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1,7 @@
|
|||
.icon[data-v-0273bbfb]{width:1em;height:1em;vertical-align:-.15em;fill:currentColor;overflow:hidden}
|
||||
.icon[data-v-0273bbfb] {
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
vertical-align: -.15em;
|
||||
fill: currentColor;
|
||||
overflow: hidden
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
.round[data-v-52b10b31]{border-radius:18px}
|
||||
.round[data-v-52b10b31] {
|
||||
border-radius: 18px
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
const t=""+new URL("not-data-Byd7gMOX.png",import.meta.url).href;export{t as n};
|
||||
const t = "" + new URL("not-data-Byd7gMOX.png", import.meta.url).href;
|
||||
export {t as n};
|
||||
|
|
|
|||
|
|
@ -1 +1,8 @@
|
|||
System.register([],(function(e,t){"use strict";return{execute:function(){e("n",""+new URL("not-data-Byd7gMOX.png",t.meta.url).href)}}}));
|
||||
System.register([], (function (e, t) {
|
||||
"use strict";
|
||||
return {
|
||||
execute: function () {
|
||||
e("n", "" + new URL("not-data-Byd7gMOX.png", t.meta.url).href)
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
|
|
|||
|
|
@ -1 +1,12 @@
|
|||
import{t as e,aY as a,cA as r}from"./index-CnBLdARH.js";function u(){const t=e(!0);return a(()=>{t.value=!0}),r(()=>{t.value=!1}),t}export{u};
|
||||
import {aY as a, cA as r, t as e} from "./index-CnBLdARH.js";
|
||||
|
||||
function u() {
|
||||
const t = e(!0);
|
||||
return a(() => {
|
||||
t.value = !0
|
||||
}), r(() => {
|
||||
t.value = !1
|
||||
}), t
|
||||
}
|
||||
|
||||
export {u};
|
||||
|
|
|
|||
|
|
@ -1 +1,9 @@
|
|||
import{aC as a,v as o,eH as t}from"./index-CnBLdARH.js";const l=()=>{const e=a(!1);return o(()=>{e.value=t()}),e};export{l as u};
|
||||
import {aC as a, eH as t, v as o} from "./index-CnBLdARH.js";
|
||||
|
||||
const l = () => {
|
||||
const e = a(!1);
|
||||
return o(() => {
|
||||
e.value = t()
|
||||
}), e
|
||||
};
|
||||
export {l as u};
|
||||
|
|
|
|||
|
|
@ -14,143 +14,143 @@ const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
|
|||
const activeClientIds = new Set()
|
||||
|
||||
self.addEventListener('install', function () {
|
||||
self.skipWaiting()
|
||||
self.skipWaiting()
|
||||
})
|
||||
|
||||
self.addEventListener('activate', function (event) {
|
||||
event.waitUntil(self.clients.claim())
|
||||
event.waitUntil(self.clients.claim())
|
||||
})
|
||||
|
||||
self.addEventListener('message', async function (event) {
|
||||
const clientId = event.source.id
|
||||
const clientId = event.source.id
|
||||
|
||||
if (!clientId || !self.clients) {
|
||||
return
|
||||
}
|
||||
|
||||
const client = await self.clients.get(clientId)
|
||||
|
||||
if (!client) {
|
||||
return
|
||||
}
|
||||
|
||||
const allClients = await self.clients.matchAll({
|
||||
type: 'window',
|
||||
})
|
||||
|
||||
switch (event.data) {
|
||||
case 'KEEPALIVE_REQUEST': {
|
||||
sendToClient(client, {
|
||||
type: 'KEEPALIVE_RESPONSE',
|
||||
})
|
||||
break
|
||||
if (!clientId || !self.clients) {
|
||||
return
|
||||
}
|
||||
|
||||
case 'INTEGRITY_CHECK_REQUEST': {
|
||||
sendToClient(client, {
|
||||
type: 'INTEGRITY_CHECK_RESPONSE',
|
||||
payload: {
|
||||
packageVersion: PACKAGE_VERSION,
|
||||
checksum: INTEGRITY_CHECKSUM,
|
||||
},
|
||||
})
|
||||
break
|
||||
const client = await self.clients.get(clientId)
|
||||
|
||||
if (!client) {
|
||||
return
|
||||
}
|
||||
|
||||
case 'MOCK_ACTIVATE': {
|
||||
activeClientIds.add(clientId)
|
||||
const allClients = await self.clients.matchAll({
|
||||
type: 'window',
|
||||
})
|
||||
|
||||
sendToClient(client, {
|
||||
type: 'MOCKING_ENABLED',
|
||||
payload: {
|
||||
client: {
|
||||
id: client.id,
|
||||
frameType: client.frameType,
|
||||
},
|
||||
},
|
||||
})
|
||||
break
|
||||
switch (event.data) {
|
||||
case 'KEEPALIVE_REQUEST': {
|
||||
sendToClient(client, {
|
||||
type: 'KEEPALIVE_RESPONSE',
|
||||
})
|
||||
break
|
||||
}
|
||||
|
||||
case 'INTEGRITY_CHECK_REQUEST': {
|
||||
sendToClient(client, {
|
||||
type: 'INTEGRITY_CHECK_RESPONSE',
|
||||
payload: {
|
||||
packageVersion: PACKAGE_VERSION,
|
||||
checksum: INTEGRITY_CHECKSUM,
|
||||
},
|
||||
})
|
||||
break
|
||||
}
|
||||
|
||||
case 'MOCK_ACTIVATE': {
|
||||
activeClientIds.add(clientId)
|
||||
|
||||
sendToClient(client, {
|
||||
type: 'MOCKING_ENABLED',
|
||||
payload: {
|
||||
client: {
|
||||
id: client.id,
|
||||
frameType: client.frameType,
|
||||
},
|
||||
},
|
||||
})
|
||||
break
|
||||
}
|
||||
|
||||
case 'MOCK_DEACTIVATE': {
|
||||
activeClientIds.delete(clientId)
|
||||
break
|
||||
}
|
||||
|
||||
case 'CLIENT_CLOSED': {
|
||||
activeClientIds.delete(clientId)
|
||||
|
||||
const remainingClients = allClients.filter((client) => {
|
||||
return client.id !== clientId
|
||||
})
|
||||
|
||||
// Unregister itself when there are no more clients
|
||||
if (remainingClients.length === 0) {
|
||||
self.registration.unregister()
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
case 'MOCK_DEACTIVATE': {
|
||||
activeClientIds.delete(clientId)
|
||||
break
|
||||
}
|
||||
|
||||
case 'CLIENT_CLOSED': {
|
||||
activeClientIds.delete(clientId)
|
||||
|
||||
const remainingClients = allClients.filter((client) => {
|
||||
return client.id !== clientId
|
||||
})
|
||||
|
||||
// Unregister itself when there are no more clients
|
||||
if (remainingClients.length === 0) {
|
||||
self.registration.unregister()
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
self.addEventListener('fetch', function (event) {
|
||||
const { request } = event
|
||||
const {request} = event
|
||||
|
||||
// Bypass navigation requests.
|
||||
if (request.mode === 'navigate') {
|
||||
return
|
||||
}
|
||||
// Bypass navigation requests.
|
||||
if (request.mode === 'navigate') {
|
||||
return
|
||||
}
|
||||
|
||||
// Opening the DevTools triggers the "only-if-cached" request
|
||||
// that cannot be handled by the worker. Bypass such requests.
|
||||
if (request.cache === 'only-if-cached' && request.mode !== 'same-origin') {
|
||||
return
|
||||
}
|
||||
// Opening the DevTools triggers the "only-if-cached" request
|
||||
// that cannot be handled by the worker. Bypass such requests.
|
||||
if (request.cache === 'only-if-cached' && request.mode !== 'same-origin') {
|
||||
return
|
||||
}
|
||||
|
||||
// Bypass all requests when there are no active clients.
|
||||
// Prevents the self-unregistered worked from handling requests
|
||||
// after it's been deleted (still remains active until the next reload).
|
||||
if (activeClientIds.size === 0) {
|
||||
return
|
||||
}
|
||||
// Bypass all requests when there are no active clients.
|
||||
// Prevents the self-unregistered worked from handling requests
|
||||
// after it's been deleted (still remains active until the next reload).
|
||||
if (activeClientIds.size === 0) {
|
||||
return
|
||||
}
|
||||
|
||||
// Generate unique request ID.
|
||||
const requestId = crypto.randomUUID()
|
||||
event.respondWith(handleRequest(event, requestId))
|
||||
// Generate unique request ID.
|
||||
const requestId = crypto.randomUUID()
|
||||
event.respondWith(handleRequest(event, requestId))
|
||||
})
|
||||
|
||||
async function handleRequest(event, requestId) {
|
||||
const client = await resolveMainClient(event)
|
||||
const response = await getResponse(event, client, requestId)
|
||||
const client = await resolveMainClient(event)
|
||||
const response = await getResponse(event, client, requestId)
|
||||
|
||||
// Send back the response clone for the "response:*" life-cycle events.
|
||||
// Ensure MSW is active and ready to handle the message, otherwise
|
||||
// this message will pend indefinitely.
|
||||
if (client && activeClientIds.has(client.id)) {
|
||||
;(async function () {
|
||||
const responseClone = response.clone()
|
||||
// Send back the response clone for the "response:*" life-cycle events.
|
||||
// Ensure MSW is active and ready to handle the message, otherwise
|
||||
// this message will pend indefinitely.
|
||||
if (client && activeClientIds.has(client.id)) {
|
||||
;(async function () {
|
||||
const responseClone = response.clone()
|
||||
|
||||
sendToClient(
|
||||
client,
|
||||
{
|
||||
type: 'RESPONSE',
|
||||
payload: {
|
||||
requestId,
|
||||
isMockedResponse: IS_MOCKED_RESPONSE in response,
|
||||
type: responseClone.type,
|
||||
status: responseClone.status,
|
||||
statusText: responseClone.statusText,
|
||||
body: responseClone.body,
|
||||
headers: Object.fromEntries(responseClone.headers.entries()),
|
||||
},
|
||||
},
|
||||
[responseClone.body],
|
||||
)
|
||||
})()
|
||||
}
|
||||
sendToClient(
|
||||
client,
|
||||
{
|
||||
type: 'RESPONSE',
|
||||
payload: {
|
||||
requestId,
|
||||
isMockedResponse: IS_MOCKED_RESPONSE in response,
|
||||
type: responseClone.type,
|
||||
status: responseClone.status,
|
||||
statusText: responseClone.statusText,
|
||||
body: responseClone.body,
|
||||
headers: Object.fromEntries(responseClone.headers.entries()),
|
||||
},
|
||||
},
|
||||
[responseClone.body],
|
||||
)
|
||||
})()
|
||||
}
|
||||
|
||||
return response
|
||||
return response
|
||||
}
|
||||
|
||||
// Resolve the main client for the given event.
|
||||
|
|
@ -158,136 +158,136 @@ async function handleRequest(event, requestId) {
|
|||
// that registered the worker. It's with the latter the worker should
|
||||
// communicate with during the response resolving phase.
|
||||
async function resolveMainClient(event) {
|
||||
const client = await self.clients.get(event.clientId)
|
||||
const client = await self.clients.get(event.clientId)
|
||||
|
||||
if (activeClientIds.has(event.clientId)) {
|
||||
return client
|
||||
}
|
||||
if (activeClientIds.has(event.clientId)) {
|
||||
return client
|
||||
}
|
||||
|
||||
if (client?.frameType === 'top-level') {
|
||||
return client
|
||||
}
|
||||
if (client?.frameType === 'top-level') {
|
||||
return client
|
||||
}
|
||||
|
||||
const allClients = await self.clients.matchAll({
|
||||
type: 'window',
|
||||
})
|
||||
|
||||
return allClients
|
||||
.filter((client) => {
|
||||
// Get only those clients that are currently visible.
|
||||
return client.visibilityState === 'visible'
|
||||
})
|
||||
.find((client) => {
|
||||
// Find the client ID that's recorded in the
|
||||
// set of clients that have registered the worker.
|
||||
return activeClientIds.has(client.id)
|
||||
const allClients = await self.clients.matchAll({
|
||||
type: 'window',
|
||||
})
|
||||
|
||||
return allClients
|
||||
.filter((client) => {
|
||||
// Get only those clients that are currently visible.
|
||||
return client.visibilityState === 'visible'
|
||||
})
|
||||
.find((client) => {
|
||||
// Find the client ID that's recorded in the
|
||||
// set of clients that have registered the worker.
|
||||
return activeClientIds.has(client.id)
|
||||
})
|
||||
}
|
||||
|
||||
async function getResponse(event, client, requestId) {
|
||||
const { request } = event
|
||||
const {request} = event
|
||||
|
||||
// Clone the request because it might've been already used
|
||||
// (i.e. its body has been read and sent to the client).
|
||||
const requestClone = request.clone()
|
||||
// Clone the request because it might've been already used
|
||||
// (i.e. its body has been read and sent to the client).
|
||||
const requestClone = request.clone()
|
||||
|
||||
function passthrough() {
|
||||
const headers = Object.fromEntries(requestClone.headers.entries())
|
||||
function passthrough() {
|
||||
const headers = Object.fromEntries(requestClone.headers.entries())
|
||||
|
||||
// Remove internal MSW request header so the passthrough request
|
||||
// complies with any potential CORS preflight checks on the server.
|
||||
// Some servers forbid unknown request headers.
|
||||
delete headers['x-msw-intention']
|
||||
// Remove internal MSW request header so the passthrough request
|
||||
// complies with any potential CORS preflight checks on the server.
|
||||
// Some servers forbid unknown request headers.
|
||||
delete headers['x-msw-intention']
|
||||
|
||||
return fetch(requestClone, { headers })
|
||||
}
|
||||
|
||||
// Bypass mocking when the client is not active.
|
||||
if (!client) {
|
||||
return passthrough()
|
||||
}
|
||||
|
||||
// Bypass initial page load requests (i.e. static assets).
|
||||
// The absence of the immediate/parent client in the map of the active clients
|
||||
// means that MSW hasn't dispatched the "MOCK_ACTIVATE" event yet
|
||||
// and is not ready to handle requests.
|
||||
if (!activeClientIds.has(client.id)) {
|
||||
return passthrough()
|
||||
}
|
||||
|
||||
// Notify the client that a request has been intercepted.
|
||||
const requestBuffer = await request.arrayBuffer()
|
||||
const clientMessage = await sendToClient(
|
||||
client,
|
||||
{
|
||||
type: 'REQUEST',
|
||||
payload: {
|
||||
id: requestId,
|
||||
url: request.url,
|
||||
mode: request.mode,
|
||||
method: request.method,
|
||||
headers: Object.fromEntries(request.headers.entries()),
|
||||
cache: request.cache,
|
||||
credentials: request.credentials,
|
||||
destination: request.destination,
|
||||
integrity: request.integrity,
|
||||
redirect: request.redirect,
|
||||
referrer: request.referrer,
|
||||
referrerPolicy: request.referrerPolicy,
|
||||
body: requestBuffer,
|
||||
keepalive: request.keepalive,
|
||||
},
|
||||
},
|
||||
[requestBuffer],
|
||||
)
|
||||
|
||||
switch (clientMessage.type) {
|
||||
case 'MOCK_RESPONSE': {
|
||||
return respondWithMock(clientMessage.data)
|
||||
return fetch(requestClone, {headers})
|
||||
}
|
||||
|
||||
case 'PASSTHROUGH': {
|
||||
return passthrough()
|
||||
// Bypass mocking when the client is not active.
|
||||
if (!client) {
|
||||
return passthrough()
|
||||
}
|
||||
}
|
||||
|
||||
return passthrough()
|
||||
// Bypass initial page load requests (i.e. static assets).
|
||||
// The absence of the immediate/parent client in the map of the active clients
|
||||
// means that MSW hasn't dispatched the "MOCK_ACTIVATE" event yet
|
||||
// and is not ready to handle requests.
|
||||
if (!activeClientIds.has(client.id)) {
|
||||
return passthrough()
|
||||
}
|
||||
|
||||
// Notify the client that a request has been intercepted.
|
||||
const requestBuffer = await request.arrayBuffer()
|
||||
const clientMessage = await sendToClient(
|
||||
client,
|
||||
{
|
||||
type: 'REQUEST',
|
||||
payload: {
|
||||
id: requestId,
|
||||
url: request.url,
|
||||
mode: request.mode,
|
||||
method: request.method,
|
||||
headers: Object.fromEntries(request.headers.entries()),
|
||||
cache: request.cache,
|
||||
credentials: request.credentials,
|
||||
destination: request.destination,
|
||||
integrity: request.integrity,
|
||||
redirect: request.redirect,
|
||||
referrer: request.referrer,
|
||||
referrerPolicy: request.referrerPolicy,
|
||||
body: requestBuffer,
|
||||
keepalive: request.keepalive,
|
||||
},
|
||||
},
|
||||
[requestBuffer],
|
||||
)
|
||||
|
||||
switch (clientMessage.type) {
|
||||
case 'MOCK_RESPONSE': {
|
||||
return respondWithMock(clientMessage.data)
|
||||
}
|
||||
|
||||
case 'PASSTHROUGH': {
|
||||
return passthrough()
|
||||
}
|
||||
}
|
||||
|
||||
return passthrough()
|
||||
}
|
||||
|
||||
function sendToClient(client, message, transferrables = []) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const channel = new MessageChannel()
|
||||
return new Promise((resolve, reject) => {
|
||||
const channel = new MessageChannel()
|
||||
|
||||
channel.port1.onmessage = (event) => {
|
||||
if (event.data && event.data.error) {
|
||||
return reject(event.data.error)
|
||||
}
|
||||
channel.port1.onmessage = (event) => {
|
||||
if (event.data && event.data.error) {
|
||||
return reject(event.data.error)
|
||||
}
|
||||
|
||||
resolve(event.data)
|
||||
}
|
||||
resolve(event.data)
|
||||
}
|
||||
|
||||
client.postMessage(
|
||||
message,
|
||||
[channel.port2].concat(transferrables.filter(Boolean)),
|
||||
)
|
||||
})
|
||||
client.postMessage(
|
||||
message,
|
||||
[channel.port2].concat(transferrables.filter(Boolean)),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
async function respondWithMock(response) {
|
||||
// Setting response status code to 0 is a no-op.
|
||||
// However, when responding with a "Response.error()", the produced Response
|
||||
// instance will have status code set to 0. Since it's not possible to create
|
||||
// a Response instance with status code 0, handle that use-case separately.
|
||||
if (response.status === 0) {
|
||||
return Response.error()
|
||||
}
|
||||
// Setting response status code to 0 is a no-op.
|
||||
// However, when responding with a "Response.error()", the produced Response
|
||||
// instance will have status code set to 0. Since it's not possible to create
|
||||
// a Response instance with status code 0, handle that use-case separately.
|
||||
if (response.status === 0) {
|
||||
return Response.error()
|
||||
}
|
||||
|
||||
const mockedResponse = new Response(response.body, response)
|
||||
const mockedResponse = new Response(response.body, response)
|
||||
|
||||
Reflect.defineProperty(mockedResponse, IS_MOCKED_RESPONSE, {
|
||||
value: true,
|
||||
enumerable: true,
|
||||
})
|
||||
Reflect.defineProperty(mockedResponse, IS_MOCKED_RESPONSE, {
|
||||
value: true,
|
||||
enumerable: true,
|
||||
})
|
||||
|
||||
return mockedResponse
|
||||
return mockedResponse
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- Created with Vectornator (http://vectornator.io/) -->
|
||||
<svg height="100%" stroke-miterlimit="10" style="fill-rule:nonzero;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;" version="1.1" viewBox="31 31 450 450" width="100%" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<svg height="100%" stroke-miterlimit="10"
|
||||
style="fill-rule:nonzero;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;" version="1.1"
|
||||
viewBox="31 31 450 450" width="100%" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<defs/>
|
||||
<g id="图层-1">
|
||||
<path d="M71.7162 480.951C245.442 476.178 386.182 360.591 424.806 237.032C433.072 210.6 428.265 188.187 407.178 174.42C397.044 167.804 393.006 171.672 385.839 175.233C380.422 177.925 373.922 182.241 379.097 187.137C382.615 190.465 380.668 194.9 379.363 197.573C375.125 206.224 355.105 205.326 334.648 195.56C314.192 185.793 301.05 170.855 305.297 162.204C308.269 156.139 318.139 154.402 332.173 157.868C339.807 159.753 341.653 156.992 343.845 153.691C347.933 147.536 345.196 145.675 341.891 144.204C333.356 140.404 321.576 138.261 309.985 137.735C145.144 133.229 267.528 285.847 51.8973 427.303C33.8726 436.816 7.71038 482.711 71.7162 480.951Z" fill="#f0322d" fill-rule="nonzero" opacity="1" stroke="none"/>
|
||||
<path d="M356.231 185.86C360.69 183.864 365.088 181.629 369.434 179.183C376.947 174.899 384.181 170.153 391.092 164.973C433.422 133.468 465.071 92.5206 477.548 73.7696C481.013 68.5621 482.62 57.4866 478.761 52.105C469.108 38.6429 449.136 31.9566 431.287 31.081C423.477 30.6979 415.771 31.6629 408.83 34.2076C405.923 35.2737 400.017 38.9675 398.218 50.6922C391.564 94.0823 368.434 127.479 353.408 149.769C349.45 155.652 345.898 160.541 342.996 164.35C341.599 166.185 338.313 170.011 335.256 172.935C332.41 175.658 332.712 180.687 336.496 183.727C341.343 187.62 351.538 187.958 356.231 185.86Z" fill="#6ec83c" fill-rule="nonzero" opacity="1" stroke="none"/>
|
||||
<g id="图层-1">
|
||||
<path d="M71.7162 480.951C245.442 476.178 386.182 360.591 424.806 237.032C433.072 210.6 428.265 188.187 407.178 174.42C397.044 167.804 393.006 171.672 385.839 175.233C380.422 177.925 373.922 182.241 379.097 187.137C382.615 190.465 380.668 194.9 379.363 197.573C375.125 206.224 355.105 205.326 334.648 195.56C314.192 185.793 301.05 170.855 305.297 162.204C308.269 156.139 318.139 154.402 332.173 157.868C339.807 159.753 341.653 156.992 343.845 153.691C347.933 147.536 345.196 145.675 341.891 144.204C333.356 140.404 321.576 138.261 309.985 137.735C145.144 133.229 267.528 285.847 51.8973 427.303C33.8726 436.816 7.71038 482.711 71.7162 480.951Z"
|
||||
fill="#f0322d" fill-rule="nonzero" opacity="1" stroke="none"/>
|
||||
<path d="M356.231 185.86C360.69 183.864 365.088 181.629 369.434 179.183C376.947 174.899 384.181 170.153 391.092 164.973C433.422 133.468 465.071 92.5206 477.548 73.7696C481.013 68.5621 482.62 57.4866 478.761 52.105C469.108 38.6429 449.136 31.9566 431.287 31.081C423.477 30.6979 415.771 31.6629 408.83 34.2076C405.923 35.2737 400.017 38.9675 398.218 50.6922C391.564 94.0823 368.434 127.479 353.408 149.769C349.45 155.652 345.898 160.541 342.996 164.35C341.599 166.185 338.313 170.011 335.256 172.935C332.41 175.658 332.712 180.687 336.496 183.727C341.343 187.62 351.538 187.958 356.231 185.86Z"
|
||||
fill="#6ec83c" fill-rule="nonzero" opacity="1" stroke="none"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
|
@ -1,19 +1,19 @@
|
|||
<!doctype html>
|
||||
<html lang="zh-cn">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta content="width=device-width,initial-scale=1" name="viewport"/>
|
||||
<title>chili3d</title>
|
||||
<link rel="icon" href="favicon.svg" />
|
||||
<link rel="stylesheet" href="index.css" />
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<script src="./iconfont.js"></script>
|
||||
<link href="favicon.svg" rel="icon"/>
|
||||
<link href="index.css" rel="stylesheet"/>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<script src="./iconfont.js"></script>
|
||||
|
||||
<script defer src="main.js"></script>
|
||||
<script>
|
||||
function jsonToBlob(json) {
|
||||
<script defer src="main.js"></script>
|
||||
<script>
|
||||
function jsonToBlob(json) {
|
||||
var textEncoder = new TextEncoder()
|
||||
var seen = new WeakSet()
|
||||
var buffer = new Uint8Array(1024 * 1024) // Start with 1MB buffer
|
||||
|
|
@ -21,153 +21,157 @@
|
|||
var stringBuffer = ''
|
||||
|
||||
function ensureCapacity(additionalBytes) {
|
||||
if (position + additionalBytes > buffer.length) {
|
||||
var newBuffer = new Uint8Array(
|
||||
Math.max(buffer.length * 2, position + additionalBytes),
|
||||
)
|
||||
newBuffer.set(buffer)
|
||||
buffer = newBuffer
|
||||
}
|
||||
if (position + additionalBytes > buffer.length) {
|
||||
var newBuffer = new Uint8Array(
|
||||
Math.max(buffer.length * 2, position + additionalBytes),
|
||||
)
|
||||
newBuffer.set(buffer)
|
||||
buffer = newBuffer
|
||||
}
|
||||
}
|
||||
|
||||
function writeToBuffer(str) {
|
||||
var encoded = textEncoder.encode(str)
|
||||
ensureCapacity(encoded.length)
|
||||
buffer.set(encoded, position)
|
||||
position += encoded.length
|
||||
var encoded = textEncoder.encode(str)
|
||||
ensureCapacity(encoded.length)
|
||||
buffer.set(encoded, position)
|
||||
position += encoded.length
|
||||
}
|
||||
|
||||
function flushStringBuffer() {
|
||||
if (stringBuffer.length > 0) {
|
||||
writeToBuffer(stringBuffer)
|
||||
stringBuffer = ''
|
||||
}
|
||||
if (stringBuffer.length > 0) {
|
||||
writeToBuffer(stringBuffer)
|
||||
stringBuffer = ''
|
||||
}
|
||||
}
|
||||
|
||||
function processValue(value) {
|
||||
if (seen.has(value)) {
|
||||
throw new TypeError('Converting circular structure to JSON')
|
||||
}
|
||||
|
||||
if (value && typeof value.toJSON === 'function') {
|
||||
value = value.toJSON()
|
||||
}
|
||||
|
||||
if (typeof value === 'object' && value !== null) {
|
||||
seen.add(value)
|
||||
|
||||
var isArray = Array.isArray(value)
|
||||
stringBuffer += isArray ? '[' : '{'
|
||||
|
||||
var first = true
|
||||
for (var [key, val] of Object.entries(value)) {
|
||||
if (!first) stringBuffer += ','
|
||||
first = false
|
||||
|
||||
if (!isArray) {
|
||||
stringBuffer += JSON.stringify(key) + ':'
|
||||
}
|
||||
|
||||
processValue(val)
|
||||
if (seen.has(value)) {
|
||||
throw new TypeError('Converting circular structure to JSON')
|
||||
}
|
||||
|
||||
stringBuffer += isArray ? ']' : '}'
|
||||
} else if (
|
||||
typeof value === 'function' ||
|
||||
typeof value === 'undefined'
|
||||
) {
|
||||
stringBuffer += 'null'
|
||||
} else {
|
||||
stringBuffer += JSON.stringify(value)
|
||||
}
|
||||
if (value && typeof value.toJSON === 'function') {
|
||||
value = value.toJSON()
|
||||
}
|
||||
|
||||
// Flush the string buffer if it gets too large
|
||||
if (stringBuffer.length > 1024) {
|
||||
flushStringBuffer()
|
||||
}
|
||||
if (typeof value === 'object' && value !== null) {
|
||||
seen.add(value)
|
||||
|
||||
var isArray = Array.isArray(value)
|
||||
stringBuffer += isArray ? '[' : '{'
|
||||
|
||||
var first = true
|
||||
for (var [key, val] of Object.entries(value)) {
|
||||
if (!first) stringBuffer += ','
|
||||
first = false
|
||||
|
||||
if (!isArray) {
|
||||
stringBuffer += JSON.stringify(key) + ':'
|
||||
}
|
||||
|
||||
processValue(val)
|
||||
}
|
||||
|
||||
stringBuffer += isArray ? ']' : '}'
|
||||
} else if (
|
||||
typeof value === 'function' ||
|
||||
typeof value === 'undefined'
|
||||
) {
|
||||
stringBuffer += 'null'
|
||||
} else {
|
||||
stringBuffer += JSON.stringify(value)
|
||||
}
|
||||
|
||||
// Flush the string buffer if it gets too large
|
||||
if (stringBuffer.length > 1024) {
|
||||
flushStringBuffer()
|
||||
}
|
||||
}
|
||||
|
||||
processValue(json)
|
||||
flushStringBuffer()
|
||||
|
||||
return new Blob([buffer.subarray(0, position)])
|
||||
}
|
||||
function getFileFromUrl(url, fileName) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var blob = null
|
||||
var xhr = new XMLHttpRequest()
|
||||
xhr.open('GET', url)
|
||||
xhr.responseType = 'blob'
|
||||
// 加载时处理
|
||||
xhr.onload = () => {
|
||||
// 获取返回结果
|
||||
blob = xhr.response
|
||||
var file = new File([blob], fileName, { type: blob.type })
|
||||
// 返回结果
|
||||
resolve(file)
|
||||
}
|
||||
xhr.onerror = e => {
|
||||
reject(e)
|
||||
}
|
||||
// 发送
|
||||
xhr.send()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function exportGLTF(input) {
|
||||
function getFileFromUrl(url, fileName) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var gltfExporter = new GLTFExporter().setTextureUtils(
|
||||
window.WebGLTextureUtils,
|
||||
)
|
||||
var params = {
|
||||
trs: false,
|
||||
onlyVisible: true,
|
||||
binary: false,
|
||||
maxTextureSize: 4096,
|
||||
}
|
||||
var options = {
|
||||
trs: params.trs,
|
||||
onlyVisible: params.onlyVisible,
|
||||
binary: params.binary,
|
||||
maxTextureSize: params.maxTextureSize,
|
||||
}
|
||||
gltfExporter.parse(
|
||||
input,
|
||||
function (result) {
|
||||
resolve(result)
|
||||
},
|
||||
function (error) {
|
||||
reject()
|
||||
console.log('An error happened during parsing', error)
|
||||
},
|
||||
options,
|
||||
)
|
||||
var blob = null
|
||||
var xhr = new XMLHttpRequest()
|
||||
xhr.open('GET', url)
|
||||
xhr.responseType = 'blob'
|
||||
// 加载时处理
|
||||
xhr.onload = () => {
|
||||
// 获取返回结果
|
||||
blob = xhr.response
|
||||
var file = new File([blob], fileName, {type: blob.type})
|
||||
// 返回结果
|
||||
resolve(file)
|
||||
}
|
||||
xhr.onerror = e => {
|
||||
reject(e)
|
||||
}
|
||||
// 发送
|
||||
xhr.send()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function createURLFromString(text) {
|
||||
var blob = new Blob([text], { type: 'text/plain' })
|
||||
function exportGLTF(input) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var gltfExporter = new GLTFExporter().setTextureUtils(
|
||||
window.WebGLTextureUtils,
|
||||
)
|
||||
var params = {
|
||||
trs: false,
|
||||
onlyVisible: true,
|
||||
binary: false,
|
||||
maxTextureSize: 4096,
|
||||
}
|
||||
var options = {
|
||||
trs: params.trs,
|
||||
onlyVisible: params.onlyVisible,
|
||||
binary: params.binary,
|
||||
maxTextureSize: params.maxTextureSize,
|
||||
}
|
||||
gltfExporter.parse(
|
||||
input,
|
||||
function (result) {
|
||||
resolve(result)
|
||||
},
|
||||
function (error) {
|
||||
reject()
|
||||
console.log('An error happened during parsing', error)
|
||||
},
|
||||
options,
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
function createURLFromString(text) {
|
||||
var blob = new Blob([text], {type: 'text/plain'})
|
||||
return URL.createObjectURL(blob)
|
||||
}
|
||||
function createURLFromJson(json) {
|
||||
}
|
||||
|
||||
function createURLFromJson(json) {
|
||||
var blob
|
||||
try {
|
||||
var text = JSON.stringify(json)
|
||||
var blob = new Blob([text], { type: 'text/plain' })
|
||||
var text = JSON.stringify(json)
|
||||
var blob = new Blob([text], {type: 'text/plain'})
|
||||
} catch (e) {
|
||||
blob = jsonToBlob(json)
|
||||
blob = jsonToBlob(json)
|
||||
}
|
||||
return URL.createObjectURL(blob)
|
||||
}
|
||||
function createURLFromArrayBuffer(arrayBuffer) {
|
||||
var blob = new Blob([arrayBuffer], { type: 'text/plain' })
|
||||
}
|
||||
|
||||
function createURLFromArrayBuffer(arrayBuffer) {
|
||||
var blob = new Blob([arrayBuffer], {type: 'text/plain'})
|
||||
return URL.createObjectURL(blob)
|
||||
}
|
||||
function lineSegments2ToLine(line) {
|
||||
}
|
||||
|
||||
function lineSegments2ToLine(line) {
|
||||
// 创建一个常规的 LineSegments 对象
|
||||
var tempLine = new window.THREE.LineSegments(
|
||||
line.geometry,
|
||||
line.material,
|
||||
line.geometry,
|
||||
line.material,
|
||||
)
|
||||
// 复制位置、旋转等属性
|
||||
tempLine.position.copy(line.position)
|
||||
|
|
@ -181,98 +185,99 @@
|
|||
// tempLine.scale.copy(line.scale)
|
||||
|
||||
return tempLine
|
||||
}
|
||||
Promise.all([
|
||||
new Promise(resolve => {
|
||||
window.onload = function () {
|
||||
var timer = setInterval(() => {
|
||||
if (window.MyApp) {
|
||||
clearInterval(timer)
|
||||
}
|
||||
|
||||
window.MyApp.newDocument('Untitled').then(myDocument => {
|
||||
resolve(myDocument)
|
||||
})
|
||||
}
|
||||
}, 100)
|
||||
}
|
||||
Promise.all([
|
||||
new Promise(resolve => {
|
||||
window.onload = function () {
|
||||
var timer = setInterval(() => {
|
||||
if (window.MyApp) {
|
||||
clearInterval(timer)
|
||||
|
||||
window.MyApp.newDocument('Untitled').then(myDocument => {
|
||||
resolve(myDocument)
|
||||
})
|
||||
}
|
||||
}, 100)
|
||||
}
|
||||
}),
|
||||
new Promise(resolve => {
|
||||
window.addEventListener(
|
||||
'message',
|
||||
({ data }) => {
|
||||
resolve(data)
|
||||
},
|
||||
false,
|
||||
)
|
||||
window.addEventListener(
|
||||
'message',
|
||||
({data}) => {
|
||||
resolve(data)
|
||||
},
|
||||
false,
|
||||
)
|
||||
}),
|
||||
])
|
||||
.then(([myDocument, { url: modelURL, filename }]) => {
|
||||
return getFileFromUrl(
|
||||
modelURL,
|
||||
filename || modelURL.split('/').pop(),
|
||||
).then(file => {
|
||||
return myDocument.application.dataExchange
|
||||
.import(myDocument, [file])
|
||||
.then(() => {
|
||||
var group = new window.THREEGroup()
|
||||
myDocument.visual.scene.children
|
||||
.filter(
|
||||
object => !object.isLight && object.type !== 'AxesHelper',
|
||||
)
|
||||
.forEach(child => {
|
||||
child.traverse(c => {
|
||||
// console.log(c, c.geometry)
|
||||
if (c.isLineSegments2) {
|
||||
// console.log(c)
|
||||
// debugger
|
||||
// console.log(c, c.geometry, c.toJSON(), c.fromJSON)
|
||||
// console.log(c.toJSON())
|
||||
// debugger
|
||||
// var line = lineSegments2ToLine(c)
|
||||
// console.log(c.parent)
|
||||
// c.parent.add(line)
|
||||
// c.parent.remove(c)
|
||||
// console.log(c.parent)
|
||||
// c.parent.add(c)
|
||||
}
|
||||
])
|
||||
.then(([myDocument, {url: modelURL, filename}]) => {
|
||||
return getFileFromUrl(
|
||||
modelURL,
|
||||
filename || modelURL.split('/').pop(),
|
||||
).then(file => {
|
||||
return myDocument.application.dataExchange
|
||||
.import(myDocument, [file])
|
||||
.then(() => {
|
||||
var group = new window.THREEGroup()
|
||||
myDocument.visual.scene.children
|
||||
.filter(
|
||||
object => !object.isLight && object.type !== 'AxesHelper',
|
||||
)
|
||||
.forEach(child => {
|
||||
child.traverse(c => {
|
||||
// console.log(c, c.geometry)
|
||||
if (c.isLineSegments2) {
|
||||
// console.log(c)
|
||||
// debugger
|
||||
// console.log(c, c.geometry, c.toJSON(), c.fromJSON)
|
||||
// console.log(c.toJSON())
|
||||
// debugger
|
||||
// var line = lineSegments2ToLine(c)
|
||||
// console.log(c.parent)
|
||||
// c.parent.add(line)
|
||||
// c.parent.remove(c)
|
||||
// console.log(c.parent)
|
||||
// c.parent.add(c)
|
||||
}
|
||||
})
|
||||
group.add(child)
|
||||
})
|
||||
|
||||
// console.log(group.toJSON())
|
||||
|
||||
var json = group.toJSON()
|
||||
// var url = createURLFromString(JSON.stringify(json, null, 2))
|
||||
var url = createURLFromJson(json)
|
||||
window.parent.postMessage({gltf: url})
|
||||
// return exportGLTF(
|
||||
// myDocument.visual.scene.children.filter(
|
||||
// object => !object.isLight && object.type !== 'AxesHelper',
|
||||
// ),
|
||||
// ).then(content => {
|
||||
// var url
|
||||
// if (content instanceof ArrayBuffer) {
|
||||
// url = createURLFromArrayBuffer(content)
|
||||
// } else {
|
||||
// url = createURLFromString(
|
||||
// JSON.stringify(content, null, 2),
|
||||
// )
|
||||
// // var link = document.createElement('a')
|
||||
// // link.style.display = 'none'
|
||||
// // document.body.appendChild(link) // Firefox workaround, see #6594
|
||||
// // link.href = url
|
||||
// // link.download = 'scene.glb'
|
||||
// // link.click()
|
||||
// }
|
||||
// window.parent.postMessage({ gltf: url })
|
||||
// })
|
||||
})
|
||||
group.add(child)
|
||||
})
|
||||
|
||||
// console.log(group.toJSON())
|
||||
|
||||
var json = group.toJSON()
|
||||
// var url = createURLFromString(JSON.stringify(json, null, 2))
|
||||
var url = createURLFromJson(json)
|
||||
window.parent.postMessage({ gltf: url })
|
||||
// return exportGLTF(
|
||||
// myDocument.visual.scene.children.filter(
|
||||
// object => !object.isLight && object.type !== 'AxesHelper',
|
||||
// ),
|
||||
// ).then(content => {
|
||||
// var url
|
||||
// if (content instanceof ArrayBuffer) {
|
||||
// url = createURLFromArrayBuffer(content)
|
||||
// } else {
|
||||
// url = createURLFromString(
|
||||
// JSON.stringify(content, null, 2),
|
||||
// )
|
||||
// // var link = document.createElement('a')
|
||||
// // link.style.display = 'none'
|
||||
// // document.body.appendChild(link) // Firefox workaround, see #6594
|
||||
// // link.href = url
|
||||
// // link.download = 'scene.glb'
|
||||
// // link.click()
|
||||
// }
|
||||
// window.parent.postMessage({ gltf: url })
|
||||
// })
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
.catch(e => {
|
||||
console.log(e)
|
||||
window.parent.postMessage({ error: e.message || e })
|
||||
console.log(e)
|
||||
window.parent.postMessage({error: e.message || e})
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,24 @@
|
|||
<!doctype html><html lang="zh-cn"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="description" content="chili3d"><meta name="author" content="仙阁"><title>chili3d</title><link rel="icon" href="favicon.svg"><link rel="stylesheet" href="index.css"><script>!function(t,e,n,c,r,a,i){t[n]=t[n]||function(){(t[n].q=t[n].q||[]).push(arguments)},(a=e.createElement(c)).async=1,a.src="https://www.clarity.ms/tag/"+r,(i=e.getElementsByTagName(c)[0]).parentNode.insertBefore(a,i)}(window,document,"clarity","script","k1qrtibhcl")</script></head><body><noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<script src="./iconfont.js"></script>
|
||||
|
||||
<!doctype html>
|
||||
<html lang="zh-cn">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta content="width=device-width,initial-scale=1" name="viewport">
|
||||
<meta content="chili3d" name="description">
|
||||
<meta content="仙阁" name="author">
|
||||
<title>chili3d</title>
|
||||
<link href="favicon.svg" rel="icon">
|
||||
<link href="index.css" rel="stylesheet">
|
||||
<script>!function (t, e, n, c, r, a, i) {
|
||||
t[n] = t[n] || function () {
|
||||
(t[n].q = t[n].q || []).push(arguments)
|
||||
}, (a = e.createElement(c)).async = 1, a.src = "https://www.clarity.ms/tag/" + r, (i = e.getElementsByTagName(c)[0]).parentNode.insertBefore(a, i)
|
||||
}(window, document, "clarity", "script", "k1qrtibhcl")</script>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<script src="./iconfont.js"></script>
|
||||
|
||||
<script defer src="main.js"></script></body></html>
|
||||
|
||||
<script defer src="main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,19 +1,42 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<link href="/favicon.ico" rel="icon"/>
|
||||
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
|
||||
<title>商飞数据库后台管理系统</title>
|
||||
<script type="module" crossorigin src="/assets/index-CnBLdARH.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-DVJlCBDm.css">
|
||||
<script type="module">import.meta.url;import("_").catch(()=>1);(async function*(){})().next();if(location.protocol!="file:"){window.__vite_is_modern_browser=true}</script>
|
||||
<script type="module">!function(){if(window.__vite_is_modern_browser)return;console.warn("vite: loading legacy chunks, syntax error above and the same error below should be ignored");var e=document.getElementById("vite-legacy-polyfill"),n=document.createElement("script");n.src=e.src,n.onload=function(){System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))},document.body.appendChild(n)}();</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script nomodule>!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",(function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()}),!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script>
|
||||
<script nomodule crossorigin id="vite-legacy-polyfill" src="/assets/polyfills-legacy-vTdn31Iz.js"></script>
|
||||
<script nomodule crossorigin id="vite-legacy-entry" data-src="/assets/index-legacy-BU4eSv88.js">System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))</script>
|
||||
</body>
|
||||
<script crossorigin src="/assets/index-CnBLdARH.js" type="module"></script>
|
||||
<link crossorigin href="/assets/index-DVJlCBDm.css" rel="stylesheet">
|
||||
<script type="module">import.meta.url;
|
||||
import("_").catch(() => 1);
|
||||
(async function* () {
|
||||
})().next();
|
||||
if (location.protocol != "file:") {
|
||||
window.__vite_is_modern_browser = true
|
||||
}</script>
|
||||
<script type="module">!function () {
|
||||
if (window.__vite_is_modern_browser) return;
|
||||
console.warn("vite: loading legacy chunks, syntax error above and the same error below should be ignored");
|
||||
var e = document.getElementById("vite-legacy-polyfill"), n = document.createElement("script");
|
||||
n.src = e.src, n.onload = function () {
|
||||
System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))
|
||||
}, document.body.appendChild(n)
|
||||
}();</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script nomodule>!function () {
|
||||
var e = document, t = e.createElement("script");
|
||||
if (!("noModule" in t) && "onbeforeload" in t) {
|
||||
var n = !1;
|
||||
e.addEventListener("beforeload", (function (e) {
|
||||
if (e.target === t) n = !0; else if (!e.target.hasAttribute("nomodule") || !n) return;
|
||||
e.preventDefault()
|
||||
}), !0), t.type = "module", t.src = ".", e.head.appendChild(t), t.remove()
|
||||
}
|
||||
}();</script>
|
||||
<script crossorigin id="vite-legacy-polyfill" nomodule src="/assets/polyfills-legacy-vTdn31Iz.js"></script>
|
||||
<script crossorigin data-src="/assets/index-legacy-BU4eSv88.js" id="vite-legacy-entry"
|
||||
nomodule>System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,38 +1,15 @@
|
|||
//import com.electromagnetic.industry.software.manage.Application;
|
||||
//import jakarta.annotation.Resource;
|
||||
//import org.junit.jupiter.api.Test;
|
||||
//import org.springframework.ai.document.Document;
|
||||
//import org.springframework.ai.document.DocumentReader;
|
||||
//import org.springframework.ai.reader.TextReader;
|
||||
//import org.springframework.ai.transformer.splitter.TokenTextSplitter;
|
||||
//import org.springframework.ai.vectorstore.VectorStore;
|
||||
//import org.springframework.boot.test.context.SpringBootTest;
|
||||
//
|
||||
//import java.io.File;
|
||||
//import java.net.MalformedURLException;
|
||||
//import java.nio.file.Path;
|
||||
//import java.util.List;
|
||||
//
|
||||
//@SpringBootTest(classes = Application.class)
|
||||
//public class Test1 {
|
||||
//
|
||||
// @Resource
|
||||
// private VectorStore vectorStore;
|
||||
//
|
||||
// @Test
|
||||
// public void testTree() throws MalformedURLException {
|
||||
// String path = "D:/明朝那些事儿.txt";
|
||||
// File file = new File(path);
|
||||
// Path tempFile = file.toPath();
|
||||
// DocumentReader documentReader = new TextReader(String.valueOf(tempFile.toUri().toURL()));
|
||||
// List<Document> documents = new TokenTextSplitter().apply(documentReader.get());
|
||||
// documents = documents.subList(0, 200);
|
||||
// vectorStore.write(documents);
|
||||
//
|
||||
/// / Path tempFile = Paths.get(file.getAbsolutePath());
|
||||
/// / DocumentReader documentReader = new TextReader(String.valueOf(tempFile.toUri().toURL()));
|
||||
/// / List<Document> documents = documentReader.get();
|
||||
/// / vectorStore.write(documents);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
import com.electromagnetic.industry.software.manage.Application;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
@SpringBootTest(classes = Application.class)
|
||||
public class Test1 {
|
||||
|
||||
@Test
|
||||
public void test() throws MalformedURLException {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue