修复前端无法编译的问题

This commit is contained in:
2026-03-27 13:04:02 +08:00
parent 1b8fadc0c9
commit d4a8f59fd8
7 changed files with 13 additions and 131 deletions
Binary file not shown.
-27
View File
@@ -1,27 +0,0 @@
import os
def print_tree(root, prefix=""):
items = sorted(
name for name in os.listdir(root)
if name != "__pycache__"
)
total = len(items)
for i, name in enumerate(items):
path = os.path.join(root, name)
is_last = (i == total - 1)
connector = "└── " if is_last else "├── "
print(prefix + connector + name)
if os.path.isdir(path):
extension = " " if is_last else ""
print_tree(path, prefix + extension)
root_dir = r"E:\ScnuProject\InsightRadar\backend\app"
print(os.path.basename(root_dir) + "/")
print_tree(root_dir)
-57
View File
@@ -1,57 +0,0 @@
# from dotenv import load_dotenv
# import os
# import time
#
# print("step 1: loading env")
# load_dotenv()
#
# hf_token = os.getenv("HF_TOKEN")
# print("step 2:", "HF_TOKEN loaded" if hf_token else "No token")
#
# print("step 3: importing sentence-transformers")
# from sentence_transformers import SentenceTransformer
#
# print("step 4: start loading model")
# t0 = time.time()
# model = SentenceTransformer(r"E:\Models\bge-m3", local_files_only=True, device="cuda")
# print(f"step 5: model loaded in {time.time() - t0:.2f}s")
#
# print("step 6: importing sklearn/numpy")
# from sklearn.metrics.pairwise import cosine_similarity
# import numpy as np
#
# titles = [
# # A组:同品牌同产品,但含义不同
# "苹果发布新款iPhone,影像系统再次升级",
# "苹果推出全新iPhone,摄像头性能进一步增强",
# "苹果回应新款iPhone发热问题:将通过系统更新修复",
# "苹果下调部分旧款iPhone售价,新机型并未参与促销",
#
# # B组:看起来都像“苹果新闻”,但主题已变
# "苹果公司股价上涨,市值再创新高",
# "苹果供应链承压,部分零部件厂商下调全年预期",
# "苹果被曝缩减Vision产品产量,市场需求不及预期",
# "苹果发布新款MacBook,并未更新iPhone产品线",
#
# # C组:同样是“发布/推出”,但主体不同
# "华为发布新款手机,影像能力进一步提升",
# "小米推出全新手机,影像系统迎来升级",
# "OPPO发布年度旗舰机型,主打夜景拍摄",
# ]
#
# print("step 7: start encoding")
# t1 = time.time()
# embeddings = model.encode(
# titles,
# normalize_embeddings=True,
# show_progress_bar=True,
# batch_size=16
# )
# print(f"step 8: encode done in {time.time() - t1:.2f}s")
#
# sim = cosine_similarity(embeddings)
# print(np.round(sim, 4))
#
import secrets
print(secrets.token_urlsafe(64))
-34
View File
@@ -1,34 +0,0 @@
# Health
GET http://127.0.0.1:8000/
Accept: application/json
###
# Send register verification code
POST http://127.0.0.1:8000/api/v1/auth/register/send-code
Content-Type: application/json
{
"email": "demo@example.com"
}
###
# Register by verification code
POST http://127.0.0.1:8000/api/v1/auth/register
Content-Type: application/json
{
"email": "demo@example.com",
"password": "DemoPass123",
"verification_code": "123456",
"nickname": "demo_user"
}
###
# Login
POST http://127.0.0.1:8000/api/v1/auth/login
Content-Type: application/json
{
"email": "demo@example.com",
"password": "DemoPass123"
}
-1
View File
@@ -26,7 +26,6 @@ function handleToggle(event: MouseEvent) {
Math.max(y, innerHeight - y) Math.max(y, innerHeight - y)
) )
// @ts-expect-error: TypeScript 类型可能较旧,忽略 startViewTransition 报错
const transition = document.startViewTransition(() => { const transition = document.startViewTransition(() => {
themeStore.toggleTheme() themeStore.toggleTheme()
}) })
+7 -7
View File
@@ -88,8 +88,8 @@ const revisionChains = computed<RevisionChain[]>(() => {
// 组内按时间升序 // 组内按时间升序
items.sort((a, b) => safeParseTime(a.created_at) - safeParseTime(b.created_at)) items.sort((a, b) => safeParseTime(a.created_at) - safeParseTime(b.created_at))
const first = items[0] const first = items[0]!
const last = items[items.length - 1] const last = items[items.length - 1]!
// 拼接标题链,避免相邻记录重复 // 拼接标题链,避免相邻记录重复
const titles: string[] = [first.previous_headline] const titles: string[] = [first.previous_headline]
@@ -107,13 +107,13 @@ const revisionChains = computed<RevisionChain[]>(() => {
chains.push({ chains.push({
event_id, event_id,
source_name: first.source_name, source_name: first.source_name!,
titles, titles,
change_times, change_times,
first_at: first.created_at, first_at: first.created_at!,
last_at: last.created_at, last_at: last.created_at!,
change_count: items.length, change_count: items.length,
url: first.url, url: first.url!,
}) })
} }
@@ -242,7 +242,7 @@ onMounted(loadRevisions)
</span> </span>
<p class="chain-title-text">{{ title }}</p> <p class="chain-title-text">{{ title }}</p>
<span v-if="idx < chain.change_times.length" class="chain-step-time"> <span v-if="idx < chain.change_times.length" class="chain-step-time">
{{ formatTime(chain.change_times[idx]) }} {{ formatTime(chain.change_times[idx] ?? '') }}
</span> </span>
</div> </div>
<div v-if="idx < chain.titles.length - 1" class="chain-arrow"> <div v-if="idx < chain.titles.length - 1" class="chain-arrow">
+6 -5
View File
@@ -6,6 +6,7 @@ import { searchEventsTimeline } from '@/api/events'
import type { SearchTimelineResponse } from '@/types/event' import type { SearchTimelineResponse } from '@/types/event'
import UnifiedEventCard from '@/components/UnifiedEventCard.vue' import UnifiedEventCard from '@/components/UnifiedEventCard.vue'
import CustomSelect from '@/components/CustomSelect.vue' import CustomSelect from '@/components/CustomSelect.vue'
import type { ApexOptions } from 'apexcharts'
const keyword = ref('') const keyword = ref('')
const searchResult = ref<SearchTimelineResponse | null>(null) const searchResult = ref<SearchTimelineResponse | null>(null)
@@ -56,7 +57,7 @@ const filteredEvents = computed(() => {
}) })
// 热度时间线图表配置。 // 热度时间线图表配置。
const chartOptions = ref({ const chartOptions = ref<ApexOptions>({
chart: { chart: {
type: 'area', type: 'area',
height: 350, height: 350,
@@ -66,12 +67,12 @@ const chartOptions = ref({
}, },
animations: { animations: {
enabled: true, enabled: true,
easing: 'easeinout', // easing: 'easeinout',
speed: 800, speed: 800,
}, },
// 点击图表数据点:切换选中时间,再次点击则取消筛选 // 点击图表数据点:切换选中时间,再次点击则取消筛选
events: { events: {
markerClick: function(event: any, chartContext: any, { dataPointIndex }: any) { markerClick: function(event: unknown, chartContext: unknown, { dataPointIndex }: never) {
if (searchResult.value && searchResult.value.timeline[dataPointIndex]) { if (searchResult.value && searchResult.value.timeline[dataPointIndex]) {
const clickedTime = searchResult.value.timeline[dataPointIndex].time_label const clickedTime = searchResult.value.timeline[dataPointIndex].time_label
if (selectedTimeLabel.value === clickedTime) { if (selectedTimeLabel.value === clickedTime) {
@@ -368,7 +369,7 @@ async function handleSearch() {
gap: 24px; gap: 24px;
align-items: stretch; align-items: stretch;
position: relative; position: relative;
z-index: 10; z-index: 10;
} }
.search-box { .search-box {
@@ -378,7 +379,7 @@ async function handleSearch() {
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
position: relative; position: relative;
z-index: 2; z-index: 2;
} }
.tips-box { .tips-box {