Skip to content

Commit

Permalink
Version 7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Lin-Rexter committed Nov 15, 2024
1 parent f6d4950 commit b5ec0dd
Show file tree
Hide file tree
Showing 11 changed files with 4,331 additions and 2,517 deletions.
39 changes: 20 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,32 @@
"edge:deploy": "pnpm run edge:build && wasmer deploy"
},
"dependencies": {
"@clerk/localizations": "^3.2.0",
"@clerk/nextjs": "^5.7.1",
"@clerk/localizations": "^3.6.4",
"@clerk/nextjs": "^6.3.4",
"@clerk/upgrade": "^1.2.3",
"@google/generative-ai": "^0.16.1",
"@googlemaps/google-maps-services-js": "^3.4.0",
"@huggingface/inference": "^2.8.1",
"@langchain/community": "^0.3.4",
"@langchain/core": "^0.3.7",
"@langchain/ollama": "^0.1.0",
"@reduxjs/toolkit": "^2.2.8",
"@langchain/community": "^0.3.14",
"@langchain/core": "^0.3.18",
"@langchain/ollama": "^0.1.2",
"@reduxjs/toolkit": "^2.3.0",
"@supabase/ssr": "^0.4.1",
"@supabase/supabase-js": "^2.45.4",
"@supabase/supabase-js": "^2.46.1",
"@xenova/transformers": "^2.17.2",
"cron": "^3.1.7",
"deck.gl": "^9.0.32",
"cron": "^3.2.1",
"deck.gl": "^9.0.35",
"dotenv": "^16.4.5",
"flowbite-react": "^0.10.2",
"gl-matrix": "^3.4.3",
"js-tiktoken": "^1.0.15",
"kepler.gl": "^3.0.0",
"langchain": "^0.3.2",
"llamaindex": "^0.6.17",
"mapbox-gl": "^3.7.0",
"langchain": "^0.3.5",
"llamaindex": "^0.6.22",
"mapbox-gl": "^3.8.0",
"maplibre-gl": "^4.7.1",
"marked": "^14.1.2",
"next": "14.2.5",
"marked": "^14.1.4",
"next": "15.0.3",
"next-themes": "^0.3.0",
"nextjs-toploader": "^1.6.12",
"react": "18.3.1",
Expand All @@ -52,12 +53,12 @@
"tiktoken": "^1.0.17"
},
"devDependencies": {
"@types/node": "^22.7.5",
"eslint": "^8.57.1",
"@types/node": "^22.9.0",
"eslint": "^9.14.0",
"eslint-config-next": "14.3.0-canary.9",
"postcss": "^8.4.47",
"tailwindcss": "^3.4.13",
"typescript": "^5.6.2"
"postcss": "^8.4.49",
"tailwindcss": "^3.4.15",
"typescript": "^5.6.3"
},
"browser": {
"fs": false,
Expand Down
6,733 changes: 4,269 additions & 2,464 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/app/layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const metadata = {

export default function RootLayout({ children }) {
return (
<ClerkProvider localization={zhTW}>
<ClerkProvider dynamic localization={zhTW}>
<html lang="zh-Hant-TW" className={myFont.className} suppressHydrationWarning>
<head>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/flowbite.min.css" rel="stylesheet" />
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header/navbar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const Navbar_Component = () => {
-
*/

const router = useRouter()
//const router = useRouter()

return (
<nav className="relative w-full bg-white dark:bg-gray-900 py-4 lg:py-0">
Expand Down
2 changes: 1 addition & 1 deletion src/components/Main/traffic/map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ const LocationAggregatorMap = ({ off, useExistToken }) => {
<Toast_Component
icon_text={"系統訊息"}
title={"系統訊息"}
contents={warn}
contents={warn.info}
/>
}
{
Expand Down
6 changes: 3 additions & 3 deletions src/components/Main/traffic/timeline.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ const Timeline = () => {
<form className="grid w-fit">
{//isShowHistory &&
(<div className={`grid bg-gray-300 border-[2px] border-gray-100 grid-cols-auto sm:grid-cols-7 mb-2 rounded-lg gap-1 w-max ${isShowHistory ? 'opacity-100' : 'opacity-0 '} transition-all ease-in-out duration-100`}>
{
{isShowHistory &&
dayNames.map((day, index) => (
<Button type="button" key={index} color="light" className="flex font-bold items-center border-gray-800 select-none" onClick={getButtonDay}>
<div className="flex flex-row justify-between sm:flex-col sm:justify-center items-center" >
Expand Down Expand Up @@ -336,12 +336,12 @@ const Timeline = () => {
</Popover>
</div>
{
(message !== null) &&
message &&
<Toast_Component
icon_text={"系統訊息"}
title={"系統訊息"}
contents={message}
durations={1000}
durations={3000}
/>
}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useGetTraffic.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export const useGetTraffic = (disabled = false, useExistToken = true, time = [])
})

if (IsAPIRateLimit) {
warn = error
//warn = error
error = null
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/ai/langchain.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const llm = new ChatOllama({
const chain = chatPrompt.pipe(llm);

// 暫時
export const langhain_ask = async (ask) => {
export const langchain_ask = async (ask) => {
var response_dict = {
data: null,
error: null
Expand Down
2 changes: 1 addition & 1 deletion src/lib/tdx/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default async function GetToken(id, secret, test = false) {
status_code: []
}

const cookieStore = cookies()
const cookieStore = await cookies()
var TDX_Access_token = process.env.NEXT_PUBLIC_TDX_ACCESS_TOKEN

if (test) {
Expand Down
51 changes: 28 additions & 23 deletions src/lib/tdx/live_data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export async function Get_TDX_Live({ useExistToken = true }) {
SectionShapes.map((item) => {
SectionShapes_list.push(item)
})

// 處理1.的經緯度字串格式
SectionShapes_list.map((item) => {
const temp_geometry_list = []
Expand All @@ -60,6 +61,7 @@ export async function Get_TDX_Live({ useExistToken = true }) {
item.Geometry = temp_geometry_list
})
//console.log(SectionShapes_list)


// 2. 儲存各個路段ID的壅塞程度、更新時間、更新頻率、旅行時間、旅行速度
const Live_Congestion_list = {}
Expand All @@ -73,6 +75,7 @@ export async function Get_TDX_Live({ useExistToken = true }) {
let travel_speed = item.TravelSpeed
Live_Congestion_list[section_id] = [level, update_time, Update_Interval, travel_time, travel_speed]
})

//console.log(Live_Congestion_list)

// 3. 儲存各個路段ID的路段資訊
Expand All @@ -91,32 +94,34 @@ export async function Get_TDX_Live({ useExistToken = true }) {
}
SectionShapes_list.forEach((item) => {
let Section_Name = section_list[item.SectionID] // 路段名稱
let Live_Congestion = Live_Congestion_list[item.SectionID]; // 取得壅塞等級
let Live_Congestion = Live_Congestion_list[item.SectionID]; // 取得當前路段的總壅塞資訊
//let random_num = Math.round(((Math.random() * 4) + 1)) + '';
//console.log(random_num)
let congestion_info = Congestion_color[Live_Congestion[0]] // 取得壅塞等級對應的壅塞資訊
let update_time = new Date(Live_Congestion[1]).addHours(8) // 取得更新時間
let update_interval = Live_Congestion[2] // 更新頻率
let travel_time = Live_Congestion[3] // 旅行時間
let travel_speed = Live_Congestion[4] // 旅行速度
if (travel_speed == 250) {
congestion_info = Congestion_color['-1']
if (Live_Congestion?.length > 0){
let congestion_info = Congestion_color[Live_Congestion[0]] // 取得壅塞等級對應的壅塞資訊
let update_time = new Date(Live_Congestion[1]).addHours(8) // 取得更新時間
let update_interval = Live_Congestion[2] // 更新頻率
let travel_time = Live_Congestion[3] // 旅行時間
let travel_speed = Live_Congestion[4] // 旅行速度
if (travel_speed == 250) {
congestion_info = Congestion_color['-1']
}
Section_GeoJSON.features.push({
"type": "Feature",
"properties": {
"name": Section_Name,
"id": item.SectionID,
"describe": congestion_info[0],
"color": congestion_info[1],
//"congestion_level": Live_Congestion[0],
"update_time": update_time,
"update_interval": update_interval,
"travel_time": travel_time,
"travel_speed": travel_speed
},
"geometry": { "type": "MultiLineString", "coordinates": [item.Geometry] }
})
}
Section_GeoJSON.features.push({
"type": "Feature",
"properties": {
"name": Section_Name,
"id": item.SectionID,
"describe": congestion_info[0],
"color": congestion_info[1],
//"congestion_level": Live_Congestion[0],
"update_time": update_time,
"update_interval": update_interval,
"travel_time": travel_time,
"travel_speed": travel_speed
},
"geometry": { "type": "MultiLineString", "coordinates": [item.Geometry] }
})
})
//console.log(Section_GeoJSON)

Expand Down
7 changes: 5 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
"@/*": [
"./src/*"
]
},
"lib": [
"dom",
Expand All @@ -23,7 +25,8 @@
{
"name": "next"
}
]
],
"target": "ES2017"
},
"include": [
"next-env.d.ts",
Expand Down

0 comments on commit b5ec0dd

Please sign in to comment.