test ai chat
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
export interface Route {
|
||||
type: 'home' | 'user' | 'post' | 'postpage' | 'atbrowser' | 'service' | 'collection' | 'record'
|
||||
type: 'home' | 'user' | 'post' | 'postpage' | 'atbrowser' | 'service' | 'collection' | 'record' | 'chat' | 'chat-thread'
|
||||
handle?: string
|
||||
rkey?: string
|
||||
service?: string
|
||||
@@ -51,6 +51,18 @@ export function parseRoute(): Route {
|
||||
return { type: 'postpage', handle: postPageMatch[1] }
|
||||
}
|
||||
|
||||
// Chat thread: /@handle/at/chat/{rkey}
|
||||
const chatThreadMatch = path.match(/^\/@([^/]+)\/at\/chat\/([^/]+)$/)
|
||||
if (chatThreadMatch) {
|
||||
return { type: 'chat-thread', handle: chatThreadMatch[1], rkey: chatThreadMatch[2] }
|
||||
}
|
||||
|
||||
// Chat list: /@handle/at/chat
|
||||
const chatMatch = path.match(/^\/@([^/]+)\/at\/chat\/?$/)
|
||||
if (chatMatch) {
|
||||
return { type: 'chat', handle: chatMatch[1] }
|
||||
}
|
||||
|
||||
// Post detail page: /@handle/rkey (for config.collection)
|
||||
const postMatch = path.match(/^\/@([^/]+)\/([^/]+)$/)
|
||||
if (postMatch) {
|
||||
@@ -79,6 +91,10 @@ export function navigate(route: Route): void {
|
||||
path = `/@${route.handle}/at/collection/${route.collection}`
|
||||
} else if (route.type === 'record' && route.handle && route.collection && route.rkey) {
|
||||
path = `/@${route.handle}/at/collection/${route.collection}/${route.rkey}`
|
||||
} else if (route.type === 'chat' && route.handle) {
|
||||
path = `/@${route.handle}/at/chat`
|
||||
} else if (route.type === 'chat-thread' && route.handle && route.rkey) {
|
||||
path = `/@${route.handle}/at/chat/${route.rkey}`
|
||||
}
|
||||
|
||||
window.history.pushState({}, '', path)
|
||||
|
||||
Reference in New Issue
Block a user