feat: Add Rust, Swift, Kotlin, and SQL patterns to the RAG splitter and enhance frontend access token retrieval by checking sessionStorage.
This commit is contained in:
parent
f743357bd7
commit
0656062a4f
|
|
@ -453,6 +453,27 @@ class CodeSplitter:
|
|||
(r"system\s*\(", "system_call"),
|
||||
(r"send\s*\(", "dynamic_method_call"),
|
||||
],
|
||||
"rust": [
|
||||
(r"\bunsafe\b", "unsafe_code"),
|
||||
(r"Command::new", "process_execution"),
|
||||
(r"File::create", "file_creation"),
|
||||
(r"File::open", "file_access"),
|
||||
],
|
||||
"swift": [
|
||||
(r"Process\(\)", "process_start"),
|
||||
(r"try!", "force_try"),
|
||||
(r"eval\s*\(", "eval"),
|
||||
],
|
||||
"kotlin": [
|
||||
(r"Runtime\.getRuntime\(\)\.exec", "runtime_exec"),
|
||||
(r"ProcessBuilder", "process_builder"),
|
||||
(r"password\s*=", "password_assign"),
|
||||
],
|
||||
"sql": [
|
||||
(r"DROP\s+TABLE", "drop_table"),
|
||||
(r"DELETE\s+FROM", "delete_records"),
|
||||
(r"GRANT\s+ALL", "grant_privileges"),
|
||||
],
|
||||
}
|
||||
|
||||
def __init__(
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ export function useResilientStream(
|
|||
const connectInternal = useCallback(async () => {
|
||||
if (!taskId || isDisconnectingRef.current) return;
|
||||
|
||||
const token = localStorage.getItem('access_token');
|
||||
const token = localStorage.getItem('access_token') || sessionStorage.getItem('access_token');
|
||||
if (!token) {
|
||||
setError('Not authenticated');
|
||||
updateConnectionState('failed');
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ export class AgentStreamHandler {
|
|||
return;
|
||||
}
|
||||
|
||||
const token = localStorage.getItem('access_token');
|
||||
const token = localStorage.getItem('access_token') || sessionStorage.getItem('access_token');
|
||||
if (!token) {
|
||||
this.options.onError?.('未登录');
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue