[{"data":1,"prerenderedAt":2047},["ShallowReactive",2],{"docs-navigation-en":3,"mdc-d0lvp9-key":202,"docs--en-docs-api-stream":223,"surround--en-docs-api-stream":2036,"-en-docs-api-stream-description":2039},[4],{"title":5,"path":6,"stem":7,"children":8,"page":105},"Docs","\u002Fen\u002Fdocs","en\u002Fdocs",[9,49,106,144,178],{"title":10,"path":11,"stem":12,"children":13,"category":16,"description":16,"icon":48},"Getting Started","\u002Fen\u002Fdocs\u002Fgetting-started","en\u002Fdocs\u002F1.getting-started\u002F1.index",[14,18,23,28,33,38,43],{"title":15,"path":11,"stem":12,"category":16,"description":17},"Introduction",null,"Explore forms, data tables, components, and API integration in Movk Nuxt and choose a setup for Nuxt or Vue + Vite.",{"title":19,"path":20,"stem":21,"category":16,"description":22},"Installation","\u002Fen\u002Fdocs\u002Fgetting-started\u002Finstallation","en\u002Fdocs\u002F1.getting-started\u002F2.installation","Install and configure the Movk Nuxt module in a Nuxt 4 project.",{"title":24,"path":25,"stem":26,"category":16,"description":27},"Module Configuration","\u002Fen\u002Fdocs\u002Fgetting-started\u002Fconfiguration","en\u002Fdocs\u002F1.getting-started\u002F3.configuration","Configure component prefix, theme colors, fonts, API endpoints, auth strategy, response parsing rules and Toast notification behavior.",{"title":29,"path":30,"stem":31,"category":16,"description":32},"Vue \u002F Vite","\u002Fen\u002Fdocs\u002Fgetting-started\u002Fvue","en\u002Fdocs\u002F1.getting-started\u002F4.vue","Use Movk standalone components, theming and composables in a plain Vue + Vite project without Nuxt.",{"title":34,"path":35,"stem":36,"category":16,"description":37},"Theme System","\u002Fen\u002Fdocs\u002Fgetting-started\u002Ftheme","en\u002Fdocs\u002F1.getting-started\u002F5.theme","Manage colors, radius, icon sets and dark mode through module defaults, the ThemePicker component and the useTheme composable, with build-time font configuration.",{"title":39,"path":40,"stem":41,"category":16,"description":42},"Migrate to v2","\u002Fen\u002Fdocs\u002Fgetting-started\u002Fmigration","en\u002Fdocs\u002F1.getting-started\u002F6.migration","Breaking changes to handle when upgrading from v1 to v2.",{"title":44,"path":45,"stem":46,"category":16,"description":47},"AI Integration","\u002Fen\u002Fdocs\u002Fgetting-started\u002Fai","en\u002Fdocs\u002F1.getting-started\u002F7.ai","Help AI assistants understand Movk Nuxt through MCP, llms.txt and Skills.","i-lucide-square-play",{"title":50,"category":16,"description":16,"icon":51,"path":52,"stem":53,"children":54,"page":105},"Forms","i-lucide-square-pen","\u002Fen\u002Fdocs\u002Fauto-form","en\u002Fdocs\u002F2.auto-form",[55,60,65,70,75,80,85,90,95,100],{"title":56,"path":57,"stem":58,"category":16,"description":59},"Quickstart","\u002Fen\u002Fdocs\u002Fauto-form\u002Fquickstart","en\u002Fdocs\u002F2.auto-form\u002F1.quickstart","Learn the core design philosophy and basic usage of AutoForm.",{"title":61,"path":62,"stem":63,"category":16,"description":64},"Recipes","\u002Fen\u002Fdocs\u002Fauto-form\u002Frecipes","en\u002Fdocs\u002F2.auto-form\u002F10.recipes","Real-world AutoForm scenarios — login, grouped registration validation, multi-file upload and horizontal search form.",{"title":66,"path":67,"stem":68,"category":16,"description":69},"Field Types","\u002Fen\u002Fdocs\u002Fauto-form\u002Ffield-types","en\u002Fdocs\u002F2.auto-form\u002F2.field-types","Mapping of afz field types to controls and their configuration.",{"title":71,"path":72,"stem":73,"category":16,"description":74},"Objects and Arrays","\u002Fen\u002Fdocs\u002Fauto-form\u002Fobject-array","en\u002Fdocs\u002F2.auto-form\u002F3.object-array","Rendering and editing nested object and dynamic array fields.",{"title":76,"path":77,"stem":78,"category":16,"description":79},"Controls","\u002Fen\u002Fdocs\u002Fauto-form\u002Fcontrols","en\u002Fdocs\u002F2.auto-form\u002F4.controls","Map schema fields to Nuxt UI controls via the type field, or register and inject custom Vue components to extend form fields.",{"title":81,"path":82,"stem":83,"category":16,"description":84},"Metadata and Layout","\u002Fen\u002Fdocs\u002Fauto-form\u002Fmetadata-layout","en\u002Fdocs\u002F2.auto-form\u002F5.metadata-layout","Configure field properties through meta and arrange them with afz.layout.",{"title":86,"path":87,"stem":88,"category":16,"description":89},"Slots","\u002Fen\u002Fdocs\u002Fauto-form\u002Fslots","en\u002Fdocs\u002F2.auto-form\u002F6.slots","Customize AutoForm's header\u002Ffooter, field controls, before\u002Fafter field and layout content via named slots.",{"title":91,"path":92,"stem":93,"category":16,"description":94},"Reactivity and Submit","\u002Fen\u002Fdocs\u002Fauto-form\u002Freactive-submit","en\u002Fdocs\u002F2.auto-form\u002F7.reactive-submit","Reactive linkage between fields and form submission handling.",{"title":96,"path":97,"stem":98,"category":16,"description":99},"SearchForm","\u002Fen\u002Fdocs\u002Fauto-form\u002Fsearch-form","en\u002Fdocs\u002F2.auto-form\u002F8.search-form","A schema-driven, collapsible search form component.",{"title":101,"path":102,"stem":103,"category":16,"description":104},"useAutoForm","\u002Fen\u002Fdocs\u002Fauto-form\u002Fuse-auto-form","en\u002Fdocs\u002F2.auto-form\u002F9.use-auto-form","A composable for creating typed Zod schemas and managing AutoForm controls.",false,{"title":107,"path":108,"stem":109,"children":110,"category":16,"description":16,"icon":143},"DataTable","\u002Fen\u002Fdocs\u002Fdata-table","en\u002Fdocs\u002F3.data-table\u002F1.index",[111,113,118,123,128,133,138],{"title":15,"path":108,"stem":109,"category":16,"description":112},"A declarative data table based on TanStack Table, with column configuration, selection, expansion, tree data, pagination, load more and complete API reference.",{"title":114,"path":115,"stem":116,"category":16,"description":117},"Appearance","\u002Fen\u002Fdocs\u002Fdata-table\u002Fappearance","en\u002Fdocs\u002F3.data-table\u002F2.appearance","Component style overrides, pagination style overrides, stripe and borders, visual density, fit-content width, empty-cell placeholders and sticky header.",{"title":119,"path":120,"stem":121,"category":16,"description":122},"Columns","\u002Fen\u002Fdocs\u002Fdata-table\u002Fcolumns","en\u002Fdocs\u002F3.data-table\u002F3.columns","Data column configuration — fixed columns, sorting, column pinning, column resize, text truncation, tooltips, visibility and functional per-column configuration.",{"title":124,"path":125,"stem":126,"category":16,"description":127},"Special Columns","\u002Fen\u002Fdocs\u002Fdata-table\u002Fspecial-columns","en\u002Fdocs\u002F3.data-table\u002F4.special-columns","Configuration for selection, index, row-pinning and actions columns — including tree selection strategies, dynamic button props and confirmation dialogs.",{"title":129,"path":130,"stem":131,"category":16,"description":132},"Rows & Interaction","\u002Fen\u002Fdocs\u002Fdata-table\u002Frows","en\u002Fdocs\u002F3.data-table\u002F5.rows","Row selection, expandable detail slot, click behaviors, dynamic row class\u002Fstyle, hover, context menu and imperative control.",{"title":134,"path":135,"stem":136,"category":16,"description":137},"Tree Data","\u002Fen\u002Fdocs\u002Fdata-table\u002Ftree","en\u002Fdocs\u002F3.data-table\u002F6.tree","Enable tree-mode tables via childrenKey — configure expansion, cascade selection strategies, indentation and read selection results.",{"title":139,"path":140,"stem":141,"category":16,"description":142},"Pagination & Load More","\u002Fen\u002Fdocs\u002Fdata-table\u002Fpagination","en\u002Fdocs\u002F3.data-table\u002F7.pagination","Client-side auto pagination, server-side manual pagination with loading state, and bottom-trigger load-more for infinite scroll.","i-lucide-table",{"title":145,"path":146,"stem":147,"children":148,"category":16,"description":16,"icon":177},"API","\u002Fen\u002Fdocs\u002Fapi","en\u002Fdocs\u002F4.api\u002F1.index",[149,152,157,162,167,172],{"title":150,"path":146,"stem":147,"category":16,"description":151},"Overview","Nuxt data-fetching fundamentals and the core concepts and architecture of the Movk Nuxt API system.",{"title":153,"path":154,"stem":155,"category":16,"description":156},"$api","\u002Fen\u002Fdocs\u002Fapi\u002Fapi-plugin","en\u002Fdocs\u002F4.api\u002F2.api-plugin","The enhanced $fetch instance created by the api.factory plugin, supporting auth injection, data unwrapping, business code checking and multi-endpoint switching.",{"title":158,"path":159,"stem":160,"category":16,"description":161},"Hooks","\u002Fen\u002Fdocs\u002Fapi\u002Fhooks","en\u002Fdocs\u002F4.api\u002F3.hooks","Extend API system behavior via Nuxt runtime hooks — global request interception, error handling and custom 401 logic.",{"title":163,"path":164,"stem":165,"category":16,"description":166},"useApiFetch","\u002Fen\u002Fdocs\u002Fapi\u002Fuse-api-fetch","en\u002Fdocs\u002F4.api\u002F4.use-api-fetch","An API request composable built on Nuxt useFetch, providing automatic authentication, business status code checking and Toast notifications.",{"title":168,"path":169,"stem":170,"category":16,"description":171},"Upload and Download","\u002Fen\u002Fdocs\u002Fapi\u002Fupload-download","en\u002Fdocs\u002F4.api\u002F5.upload-download","File upload and download with progress tracking.",{"title":173,"path":174,"stem":175,"category":16,"description":176},"Streaming","\u002Fen\u002Fdocs\u002Fapi\u002Fstream","en\u002Fdocs\u002F4.api\u002F6.stream","SSE streaming requests and the AI SDK chat transport.","i-lucide-cloud",{"title":179,"category":16,"description":16,"icon":180,"path":181,"stem":182,"children":183,"page":105},"Components","i-lucide-box","\u002Fen\u002Fdocs\u002Fcomponents","en\u002Fdocs\u002F5.components",[184,190,196],{"title":185,"path":186,"stem":187,"category":188,"description":189},"DatePicker","\u002Fen\u002Fdocs\u002Fcomponents\u002Fdate-picker","en\u002Fdocs\u002F5.components\u002Fdate-picker","advanced","An internationalized date picker component.",{"title":191,"path":192,"stem":193,"category":194,"description":195},"MessageBox","\u002Fen\u002Fdocs\u002Fcomponents\u002Fmessage-box","en\u002Fdocs\u002F5.components\u002Fmessage-box","feedback","A modal message dialog offering both declarative and programmatic usage.",{"title":197,"path":198,"stem":199,"category":188,"description":200,"badge":201},"Tree","\u002Fen\u002Fdocs\u002Fcomponents\u002Ftree","en\u002Fdocs\u002F5.components\u002Ftree","A tree component built on Nuxt UI Tree, adding search, lazy loading, toolbar, checkboxes, and parent\u002Fchild strategy.","v1.4.2",{"data":203,"body":204},{},{"type":205,"children":206},"root",[207],{"type":208,"tag":209,"props":210,"children":211},"element","p",{},[212,215],{"type":213,"value":214},"text","Copyright © 2025 - 2026 YiXuan - ",{"type":208,"tag":216,"props":217,"children":220},"span",{"className":218},[219],"text-highlighted",[221],{"type":213,"value":222},"MIT License",{"id":224,"title":173,"body":225,"category":16,"description":176,"difficulty":16,"extension":2031,"index":105,"keywords":16,"links":16,"meta":2032,"navigation":16,"path":174,"requires":16,"seo":2033,"sitemap":2034,"stem":175,"__hash__":2035},"docs_en\u002Fen\u002Fdocs\u002F4.api\u002F6.stream.md",{"type":226,"value":227,"toc":2013},"minimark",[228,233,238,264,660,663,667,671,698,722,741,744,748,815,900,903,909,989,1003,1016,1019,1024,1029,1038,1042,1139,1143,1147,1150,1153,1183,1207,1445,1453,1457,1476,1521,1527,1683,1687,1714,1859,1863,1895,1913,1922,1925,1929,1932,1944,1947,1990,1993,2002,2005,2009],[229,230,232],"h2",{"id":231},"useapistream","useApiStream",[234,235,237],"h3",{"id":236},"usage","Usage",[209,239,240,243,244,251,252,255,256,259,260,263],{},[241,242,232],"code",{}," is the reactive shell around ",[245,246,248],"a",{"href":247},"#apistream",[241,249,250],{},"$api.stream()",". It returns a lazy async generator: the request only starts once you begin iterating. Line buffering, multi-line ",[241,253,254],{},"data:"," concatenation, comment lines and ",[241,257,258],{},"\\r\\n"," handling are delegated to ",[241,261,262],{},"eventsource-parser","; events that fail to parse are skipped silently — a heartbeat or handshake line should never break the whole stream.",[265,266,271],"pre",{"className":267,"code":268,"language":269,"meta":270,"style":270},"language-vue shiki shiki-themes github-light github-light github-dark","\u003Cscript setup lang=\"ts\">\ninterface ChatChunk {\n  content: string\n  done: boolean\n}\n\nconst text = ref('')\nconst { status, error, stream, abort } = useApiStream\u003CChatChunk>()\n\nasync function start() {\n  text.value = ''\n\n  for await (const chunk of stream('\u002Fchat', { method: 'POST', body: { message: 'Hello' } })) {\n    text.value += chunk.content\n  }\n}\n\u003C\u002Fscript>\n\n\u003Ctemplate>\n  \u003CUButton :loading=\"status === 'streaming'\" @click=\"start\">Start\u003C\u002FUButton>\n  \u003CUButton v-if=\"status === 'streaming'\" @click=\"abort\">Abort\u003C\u002FUButton>\n  \u003Cp>{{ text }}\u003C\u002Fp>\n\u003C\u002Ftemplate>\n","vue","",[241,272,273,302,315,329,340,346,353,377,420,425,440,451,456,499,511,517,522,532,537,547,598,637,651],{"__ignoreMap":270},[216,274,277,281,285,289,292,295,299],{"class":275,"line":276},"line",1,[216,278,280],{"class":279},"sxrX7","\u003C",[216,282,284],{"class":283},"sovSZ","script",[216,286,288],{"class":287},"snPdu"," setup",[216,290,291],{"class":287}," lang",[216,293,294],{"class":279},"=",[216,296,298],{"class":297},"sIIMD","\"ts\"",[216,300,301],{"class":279},">\n",[216,303,305,309,312],{"class":275,"line":304},2,[216,306,308],{"class":307},"s8jYJ","interface",[216,310,311],{"class":287}," ChatChunk",[216,313,314],{"class":279}," {\n",[216,316,318,322,325],{"class":275,"line":317},3,[216,319,321],{"class":320},"sP4rz","  content",[216,323,324],{"class":307},":",[216,326,328],{"class":327},"sBjJW"," string\n",[216,330,332,335,337],{"class":275,"line":331},4,[216,333,334],{"class":320},"  done",[216,336,324],{"class":307},[216,338,339],{"class":327}," boolean\n",[216,341,343],{"class":275,"line":342},5,[216,344,345],{"class":279},"}\n",[216,347,349],{"class":275,"line":348},6,[216,350,352],{"emptyLinePlaceholder":351},true,"\n",[216,354,356,359,362,365,368,371,374],{"class":275,"line":355},7,[216,357,358],{"class":307},"const",[216,360,361],{"class":327}," text",[216,363,364],{"class":307}," =",[216,366,367],{"class":287}," ref",[216,369,370],{"class":279},"(",[216,372,373],{"class":297},"''",[216,375,376],{"class":279},")\n",[216,378,380,382,385,388,391,394,396,399,401,404,407,409,412,414,417],{"class":275,"line":379},8,[216,381,358],{"class":307},[216,383,384],{"class":279}," { ",[216,386,387],{"class":327},"status",[216,389,390],{"class":279},", ",[216,392,393],{"class":327},"error",[216,395,390],{"class":279},[216,397,398],{"class":327},"stream",[216,400,390],{"class":279},[216,402,403],{"class":327},"abort",[216,405,406],{"class":279}," } ",[216,408,294],{"class":307},[216,410,411],{"class":287}," useApiStream",[216,413,280],{"class":279},[216,415,416],{"class":287},"ChatChunk",[216,418,419],{"class":279},">()\n",[216,421,423],{"class":275,"line":422},9,[216,424,352],{"emptyLinePlaceholder":351},[216,426,428,431,434,437],{"class":275,"line":427},10,[216,429,430],{"class":307},"async",[216,432,433],{"class":307}," function",[216,435,436],{"class":287}," start",[216,438,439],{"class":279},"() {\n",[216,441,443,446,448],{"class":275,"line":442},11,[216,444,445],{"class":279},"  text.value ",[216,447,294],{"class":307},[216,449,450],{"class":297}," ''\n",[216,452,454],{"class":275,"line":453},12,[216,455,352],{"emptyLinePlaceholder":351},[216,457,459,462,465,468,470,473,476,479,481,484,487,490,493,496],{"class":275,"line":458},13,[216,460,461],{"class":307},"  for",[216,463,464],{"class":307}," await",[216,466,467],{"class":279}," (",[216,469,358],{"class":307},[216,471,472],{"class":327}," chunk",[216,474,475],{"class":307}," of",[216,477,478],{"class":287}," stream",[216,480,370],{"class":279},[216,482,483],{"class":297},"'\u002Fchat'",[216,485,486],{"class":279},", { method: ",[216,488,489],{"class":297},"'POST'",[216,491,492],{"class":279},", body: { message: ",[216,494,495],{"class":297},"'Hello'",[216,497,498],{"class":279}," } })) {\n",[216,500,502,505,508],{"class":275,"line":501},14,[216,503,504],{"class":279},"    text.value ",[216,506,507],{"class":307},"+=",[216,509,510],{"class":279}," chunk.content\n",[216,512,514],{"class":275,"line":513},15,[216,515,516],{"class":279},"  }\n",[216,518,520],{"class":275,"line":519},16,[216,521,345],{"class":279},[216,523,525,528,530],{"class":275,"line":524},17,[216,526,527],{"class":279},"\u003C\u002F",[216,529,284],{"class":283},[216,531,301],{"class":279},[216,533,535],{"class":275,"line":534},18,[216,536,352],{"emptyLinePlaceholder":351},[216,538,540,542,545],{"class":275,"line":539},19,[216,541,280],{"class":279},[216,543,544],{"class":283},"template",[216,546,301],{"class":279},[216,548,550,553,556,559,562,564,567,570,573,576,579,582,584,586,589,591,594,596],{"class":275,"line":549},20,[216,551,552],{"class":279},"  \u003C",[216,554,555],{"class":283},"UButton",[216,557,558],{"class":279}," :",[216,560,561],{"class":287},"loading",[216,563,294],{"class":279},[216,565,566],{"class":297},"\"",[216,568,569],{"class":279},"status ",[216,571,572],{"class":307},"===",[216,574,575],{"class":297}," 'streaming'\"",[216,577,578],{"class":279}," @",[216,580,581],{"class":287},"click",[216,583,294],{"class":279},[216,585,566],{"class":297},[216,587,588],{"class":279},"start",[216,590,566],{"class":297},[216,592,593],{"class":279},">Start\u003C\u002F",[216,595,555],{"class":283},[216,597,301],{"class":279},[216,599,601,603,605,608,610,612,614,616,618,620,622,624,626,628,630,633,635],{"class":275,"line":600},21,[216,602,552],{"class":279},[216,604,555],{"class":283},[216,606,607],{"class":307}," v-if",[216,609,294],{"class":279},[216,611,566],{"class":297},[216,613,569],{"class":279},[216,615,572],{"class":307},[216,617,575],{"class":297},[216,619,578],{"class":279},[216,621,581],{"class":287},[216,623,294],{"class":279},[216,625,566],{"class":297},[216,627,403],{"class":279},[216,629,566],{"class":297},[216,631,632],{"class":279},">Abort\u003C\u002F",[216,634,555],{"class":283},[216,636,301],{"class":279},[216,638,640,642,644,647,649],{"class":275,"line":639},22,[216,641,552],{"class":279},[216,643,209],{"class":283},[216,645,646],{"class":279},">{{ text }}\u003C\u002F",[216,648,209],{"class":283},[216,650,301],{"class":279},[216,652,654,656,658],{"class":275,"line":653},23,[216,655,527],{"class":279},[216,657,544],{"class":283},[216,659,301],{"class":279},[209,661,662],{},"Starting a new stream aborts the previous one, and so does the component scope being disposed.",[234,664,666],{"id":665},"how-accept-and-responsetype-are-handled","How Accept and responseType are handled",[668,669,670],"warning",{},"Both defaults were settled the hard way. Check your gateway's behaviour before changing them.",[209,672,673,685,686,689,690,693,694,697],{},[674,675,676,677,680,681,684],"strong",{},"Accept defaults to the wildcard — neither ",[241,678,679],{},"application\u002Fjson"," nor ",[241,682,683],{},"text\u002Fevent-stream","."," ofetch automatically adds ",[241,687,688],{},"Accept: application\u002Fjson"," whenever the body is JSON-serializable, which is simply the wrong claim for a request you intend to read as a stream: a backend negotiating on ",[241,691,692],{},"Accept"," may switch to its JSON renderer because of it. Sending ",[241,695,696],{},"Accept: text\u002Fevent-stream"," instead gets the whole request rejected by those same backends (DRF, for instance) — verified against one that answers \"cannot satisfy the Accept HTTP header\" before any business logic runs. The wildcard avoids both. Gateways that need a specific value can pass one, and an explicit header always wins:",[265,699,703],{"className":700,"code":701,"language":702,"meta":270,"style":270},"language-ts shiki shiki-themes github-light github-light github-dark","stream('\u002Fchat', { headers: { Accept: 'text\u002Fevent-stream' } })\n","ts",[241,704,705],{"__ignoreMap":270},[216,706,707,709,711,713,716,719],{"class":275,"line":276},[216,708,398],{"class":287},[216,710,370],{"class":279},[216,712,483],{"class":297},[216,714,715],{"class":279},", { headers: { Accept: ",[216,717,718],{"class":297},"'text\u002Fevent-stream'",[216,720,721],{"class":279}," } })\n",[209,723,724,730,731,733,734,736,737,740],{},[674,725,726,729],{},[241,727,728],{},"responseType: 'stream'"," by default",": an event stream is read as a stream even when a gateway mislabels it as something other than ",[241,732,683],{},". An ",[241,735,679],{}," response (including HTTP 200 error envelopes like ",[241,738,739],{},"{ code: 500 }",") is first restored to an object by the interceptor and then goes through business-code validation to surface the backend message, instead of turning into a stream that never yields anything.",[209,742,743],{},"A readable error is thrown when the response body is not a stream, so nothing spins silently.",[234,745,747],{"id":746},"errors-and-aborts","Errors and aborts",[749,750,751,772,801],"ul",{},[752,753,754,755,758,759,761,762,390,765,767,768,771],"li",{},"Deliberate aborts (",[241,756,757],{},"abort()",", starting a new stream, scope disposal) are not errors: ",[241,760,387],{}," becomes ",[241,763,764],{},"'aborted'",[241,766,393],{}," stays ",[241,769,770],{},"null"," and iteration ends silently",[752,773,774,775,777,778,780,781,784,785,788,789,792,793,796,797,800],{},"Any other error is written to ",[241,776,393],{},", sets ",[241,779,387],{}," to ",[241,782,783],{},"'error'",", calls ",[241,786,787],{},"onError"," and is then ",[674,790,791],{},"re-thrown",", so a ",[241,794,795],{},"try\u002Fcatch"," around ",[241,798,799],{},"for await"," can handle it",[752,802,803,804,806,807,810,811,814],{},"Business errors (a ",[241,805,241],{}," outside ",[241,808,809],{},"successCodes",") are thrown by the interceptor before the stream starts, with the toast and the ",[241,812,813],{},"movk:api:error"," hook firing as usual",[265,816,818],{"className":700,"code":817,"language":702,"meta":270,"style":270},"try {\n  for await (const chunk of stream('\u002Fchat', { onError: e => console.error(e) })) {\n    \u002F\u002F ...\n  }\n}\ncatch (error) {\n  \u002F\u002F business error, HTTP error or broken stream\n}\n",[241,819,820,827,869,875,879,883,891,896],{"__ignoreMap":270},[216,821,822,825],{"class":275,"line":276},[216,823,824],{"class":307},"try",[216,826,314],{"class":279},[216,828,829,831,833,835,837,839,841,843,845,847,850,852,855,858,861,864,866],{"class":275,"line":304},[216,830,461],{"class":307},[216,832,464],{"class":307},[216,834,467],{"class":279},[216,836,358],{"class":307},[216,838,472],{"class":327},[216,840,475],{"class":307},[216,842,478],{"class":287},[216,844,370],{"class":279},[216,846,483],{"class":297},[216,848,849],{"class":279},", { ",[216,851,787],{"class":287},[216,853,854],{"class":279},": ",[216,856,857],{"class":320},"e",[216,859,860],{"class":307}," =>",[216,862,863],{"class":279}," console.",[216,865,393],{"class":287},[216,867,868],{"class":279},"(e) })) {\n",[216,870,871],{"class":275,"line":317},[216,872,874],{"class":873},"sCsY4","    \u002F\u002F ...\n",[216,876,877],{"class":275,"line":331},[216,878,516],{"class":279},[216,880,881],{"class":275,"line":342},[216,882,345],{"class":279},[216,884,885,888],{"class":275,"line":348},[216,886,887],{"class":307},"catch",[216,889,890],{"class":279}," (error) {\n",[216,892,893],{"class":275,"line":355},[216,894,895],{"class":873},"  \u002F\u002F business error, HTTP error or broken stream\n",[216,897,898],{"class":275,"line":379},[216,899,345],{"class":279},[234,901,250],{"id":902},"apistream",[209,904,905,906,908],{},"Outside components, or when reactive state is not needed, call ",[241,907,250],{}," directly:",[265,910,912],{"className":700,"code":911,"language":702,"meta":270,"style":270},"const { $api } = useNuxtApp()\n\nfor await (const chunk of await $api.stream\u003CChatChunk>('\u002Fchat', { method: 'POST', body })) {\n  console.log(chunk.content)\n}\n",[241,913,914,932,936,974,985],{"__ignoreMap":270},[216,915,916,918,920,922,924,926,929],{"class":275,"line":276},[216,917,358],{"class":307},[216,919,384],{"class":279},[216,921,153],{"class":327},[216,923,406],{"class":279},[216,925,294],{"class":307},[216,927,928],{"class":287}," useNuxtApp",[216,930,931],{"class":279},"()\n",[216,933,934],{"class":275,"line":304},[216,935,352],{"emptyLinePlaceholder":351},[216,937,938,941,943,945,947,949,951,953,956,958,960,962,965,967,969,971],{"class":275,"line":317},[216,939,940],{"class":307},"for",[216,942,464],{"class":307},[216,944,467],{"class":279},[216,946,358],{"class":307},[216,948,472],{"class":327},[216,950,475],{"class":307},[216,952,464],{"class":307},[216,954,955],{"class":279}," $api.",[216,957,398],{"class":287},[216,959,280],{"class":279},[216,961,416],{"class":287},[216,963,964],{"class":279},">(",[216,966,483],{"class":297},[216,968,486],{"class":279},[216,970,489],{"class":297},[216,972,973],{"class":279},", body })) {\n",[216,975,976,979,982],{"class":275,"line":331},[216,977,978],{"class":279},"  console.",[216,980,981],{"class":287},"log",[216,983,984],{"class":279},"(chunk.content)\n",[216,986,987],{"class":275,"line":342},[216,988,345],{"class":279},[209,990,991,992,995,996,999,1000,684],{},"When the response is a stream the response interceptor short-circuits entirely — no unwrapping, no business-code check, no success toast — and ",[241,993,994],{},"_data"," is left untouched, so callers no longer need ",[241,997,998],{},"unwrap"," \u002F ",[241,1001,1002],{},"businessCheck",[209,1004,1005,1006,1009,1010,1015],{},"To plug into the AI SDK and ",[241,1007,1008],{},"@nuxt\u002Fui"," Chat components, use ",[245,1011,1012],{"href":174},[241,1013,1014],{},"createChatTransport"," instead.",[234,1017,145],{"id":1018},"api",[1020,1021,1023],"h4",{"id":1022},"useapistream-1","useApiStream()",[1025,1026,1028],"h5",{"id":1027},"type-parameters","Type Parameters",[1030,1031,1032],"field-group",{},[1033,1034,1037],"field",{"name":1035,"type":1036},"T","unknown","Type of a single chunk.",[1025,1039,1041],{"id":1040},"returns","Returns",[1030,1043,1044,1055,1059,1131],{},[1033,1045,1047,1050,1051,1054],{"name":387,"type":1046},"Ref\u003CApiStreamStatus>",[241,1048,1049],{},"'idle' | 'streaming' | 'success' | 'error' | 'aborted'",". Stays ",[241,1052,1053],{},"'idle'"," until iteration starts.",[1033,1056,1058],{"name":393,"type":1057},"Ref\u003CApiError | Error | null>","Error information; deliberate aborts are not written here.",[1033,1060,1063,1066,1071],{"name":1061,"type":1062},"stream()","(url: string, options?: UseApiStreamOptions\u003CT>) => AsyncGenerator\u003CT>",[209,1064,1065],{},"Starts the streaming request and yields chunks one by one.",[209,1067,1068],{},[674,1069,1070],{},"Parameters",[1030,1072,1073,1078],{},[1033,1074],{"name":1075,"type":1076,":required":1077},"url","string","true",[1033,1079,1082],{"name":1080,"type":1081},"options","UseApiStreamOptions\u003CT>",[1083,1084,1085],"collapsible",{},[1030,1086,1087,1094,1106,1110],{},[1033,1088,1090,1091,684],{"name":1089,"type":1076},"endpoint","Endpoint name to use; defaults to ",[241,1092,1093],{},"defaultEndpoint",[1033,1095,1098,1099,1102,1103,684],{"name":1096,"type":1097},"parse","(data: string) => T | undefined","How to decode a single SSE event's data; return ",[241,1100,1101],{},"undefined"," to drop it. Defaults to a fault-tolerant ",[241,1104,1105],{},"JSON.parse",[1033,1107,1109],{"name":787,"type":1108},"(error: ApiError | Error) => void","Failure callback; not triggered on deliberate aborts.",[1033,1111,1114,1115,390,1118,390,1121,390,1124,390,1127,1130],{"name":1112,"type":1113},"...FetchOptions","FetchOptions","Every other option is forwarded to ofetch: ",[241,1116,1117],{},"method",[241,1119,1120],{},"body",[241,1122,1123],{},"headers",[241,1125,1126],{},"query",[241,1128,1129],{},"responseType"," and so on.",[1033,1132,1134,1135,780,1137,684],{"name":757,"type":1133},"() => void","Aborts the current stream and sets ",[241,1136,387],{},[241,1138,764],{},[234,1140,1142],{"id":1141},"changelog","Changelog",[1144,1145],"commit-changelog",{"prefix":1146,"suffix":702},"composables",[229,1148,1014],{"id":1149},"createchattransport",[234,1151,237],{"id":1152},"usage-1",[209,1154,1155,1157,1158,1161,1162,1165,1166,1169,1170,1172,1173],{},[241,1156,1008],{},"'s ",[241,1159,1160],{},"UChat*"," components render AI SDK ",[241,1163,1164],{},"UIMessage","s; all protocol parsing lives in the ",[241,1167,1168],{},"ai"," package and only understands the AI SDK's own UI Message Stream format. Internal gateways (MaxKB, Dify, FastGPT, in-house ones) each ship a different chunk shape, and ",[241,1171,1014],{}," fills exactly that gap: ",[674,1174,1175,1176,1179,1180,684],{},"your domain code writes one stateless ",[241,1177,1178],{},"select",", everything else is inherited from the AI SDK's ",[241,1181,1182],{},"HttpChatTransport",[1184,1185,1186,1187,1194,1195,1198,1199,1202,1203,1206],"note",{},"Install ",[245,1188,1192],{"href":1189,"rel":1190},"https:\u002F\u002Fai-sdk.dev",[1191],"nofollow",[241,1193,1168],{}," (an optional peer of ",[241,1196,1197],{},"@movk\u002Fnuxt",") and ",[241,1200,1201],{},"@ai-sdk\u002Fvue",", then import from the ",[241,1204,1205],{},"@movk\u002Fnuxt\u002Fai"," subpath — the main entry never pulls in the AI SDK.",[265,1208,1210],{"className":267,"code":1209,"language":269,"meta":270,"style":270},"\u003Cscript setup lang=\"ts\">\nimport { createChatTransport } from '@movk\u002Fnuxt\u002Fai'\nimport { useChat } from '@ai-sdk\u002Fvue'\n\ninterface GatewayChunk {\n  content: string\n  node_id: string\n  runtime_node_id: string\n  node_is_end: boolean\n  is_end: boolean\n}\n\nconst transport = createChatTransport\u003CGatewayChunk>({\n  api: '\u002Fchat\u002Fcompletions',\n  select: raw => ({\n    id: raw.runtime_node_id,\n    delta: raw.content,\n    end: raw.node_is_end,\n    finished: raw.is_end\n  })\n})\n\nconst { messages, status, error, sendMessage, stop } = useChat({ transport })\n\u003C\u002Fscript>\n",[241,1211,1212,1228,1242,1254,1258,1267,1275,1284,1293,1302,1311,1315,1319,1339,1350,1365,1370,1375,1380,1385,1390,1395,1399,1436],{"__ignoreMap":270},[216,1213,1214,1216,1218,1220,1222,1224,1226],{"class":275,"line":276},[216,1215,280],{"class":279},[216,1217,284],{"class":283},[216,1219,288],{"class":287},[216,1221,291],{"class":287},[216,1223,294],{"class":279},[216,1225,298],{"class":297},[216,1227,301],{"class":279},[216,1229,1230,1233,1236,1239],{"class":275,"line":304},[216,1231,1232],{"class":307},"import",[216,1234,1235],{"class":279}," { createChatTransport } ",[216,1237,1238],{"class":307},"from",[216,1240,1241],{"class":297}," '@movk\u002Fnuxt\u002Fai'\n",[216,1243,1244,1246,1249,1251],{"class":275,"line":317},[216,1245,1232],{"class":307},[216,1247,1248],{"class":279}," { useChat } ",[216,1250,1238],{"class":307},[216,1252,1253],{"class":297}," '@ai-sdk\u002Fvue'\n",[216,1255,1256],{"class":275,"line":331},[216,1257,352],{"emptyLinePlaceholder":351},[216,1259,1260,1262,1265],{"class":275,"line":342},[216,1261,308],{"class":307},[216,1263,1264],{"class":287}," GatewayChunk",[216,1266,314],{"class":279},[216,1268,1269,1271,1273],{"class":275,"line":348},[216,1270,321],{"class":320},[216,1272,324],{"class":307},[216,1274,328],{"class":327},[216,1276,1277,1280,1282],{"class":275,"line":355},[216,1278,1279],{"class":320},"  node_id",[216,1281,324],{"class":307},[216,1283,328],{"class":327},[216,1285,1286,1289,1291],{"class":275,"line":379},[216,1287,1288],{"class":320},"  runtime_node_id",[216,1290,324],{"class":307},[216,1292,328],{"class":327},[216,1294,1295,1298,1300],{"class":275,"line":422},[216,1296,1297],{"class":320},"  node_is_end",[216,1299,324],{"class":307},[216,1301,339],{"class":327},[216,1303,1304,1307,1309],{"class":275,"line":427},[216,1305,1306],{"class":320},"  is_end",[216,1308,324],{"class":307},[216,1310,339],{"class":327},[216,1312,1313],{"class":275,"line":442},[216,1314,345],{"class":279},[216,1316,1317],{"class":275,"line":453},[216,1318,352],{"emptyLinePlaceholder":351},[216,1320,1321,1323,1326,1328,1331,1333,1336],{"class":275,"line":458},[216,1322,358],{"class":307},[216,1324,1325],{"class":327}," transport",[216,1327,364],{"class":307},[216,1329,1330],{"class":287}," createChatTransport",[216,1332,280],{"class":279},[216,1334,1335],{"class":287},"GatewayChunk",[216,1337,1338],{"class":279},">({\n",[216,1340,1341,1344,1347],{"class":275,"line":501},[216,1342,1343],{"class":279},"  api: ",[216,1345,1346],{"class":297},"'\u002Fchat\u002Fcompletions'",[216,1348,1349],{"class":279},",\n",[216,1351,1352,1355,1357,1360,1362],{"class":275,"line":513},[216,1353,1354],{"class":287},"  select",[216,1356,854],{"class":279},[216,1358,1359],{"class":320},"raw",[216,1361,860],{"class":307},[216,1363,1364],{"class":279}," ({\n",[216,1366,1367],{"class":275,"line":519},[216,1368,1369],{"class":279},"    id: raw.runtime_node_id,\n",[216,1371,1372],{"class":275,"line":524},[216,1373,1374],{"class":279},"    delta: raw.content,\n",[216,1376,1377],{"class":275,"line":534},[216,1378,1379],{"class":279},"    end: raw.node_is_end,\n",[216,1381,1382],{"class":275,"line":539},[216,1383,1384],{"class":279},"    finished: raw.is_end\n",[216,1386,1387],{"class":275,"line":549},[216,1388,1389],{"class":279},"  })\n",[216,1391,1392],{"class":275,"line":600},[216,1393,1394],{"class":279},"})\n",[216,1396,1397],{"class":275,"line":639},[216,1398,352],{"emptyLinePlaceholder":351},[216,1400,1401,1403,1405,1408,1410,1412,1414,1416,1418,1421,1423,1426,1428,1430,1433],{"class":275,"line":653},[216,1402,358],{"class":307},[216,1404,384],{"class":279},[216,1406,1407],{"class":327},"messages",[216,1409,390],{"class":279},[216,1411,387],{"class":327},[216,1413,390],{"class":279},[216,1415,393],{"class":327},[216,1417,390],{"class":279},[216,1419,1420],{"class":327},"sendMessage",[216,1422,390],{"class":279},[216,1424,1425],{"class":327},"stop",[216,1427,406],{"class":279},[216,1429,294],{"class":307},[216,1431,1432],{"class":287}," useChat",[216,1434,1435],{"class":279},"({ transport })\n",[216,1437,1439,1441,1443],{"class":275,"line":1438},24,[216,1440,527],{"class":279},[216,1442,284],{"class":283},[216,1444,301],{"class":279},[209,1446,1447,1449,1450,1452],{},[241,1448,1014],{}," reads ",[241,1451,153],{}," internally, so call it inside a setup scope.",[234,1454,1456],{"id":1455},"the-select-mapping","The select mapping",[209,1458,1459,1461,1462,1464,1465,1467,1468,1471,1472,1475],{},[241,1460,1178],{}," is a pure function: given one backend chunk, it states which UI parts that chunk produces; return ",[241,1463,1101],{}," to produce nothing. The lifecycle is handled by the transport — ",[241,1466,588],{}," is emitted once, text blocks are opened and closed per ",[241,1469,1470],{},"id",", and every unclosed block plus ",[241,1473,1474],{},"finish"," is flushed when the stream ends, so a missing end signal or a broken connection never leaves the message stuck in streaming.",[1030,1477,1478,1484,1492,1497,1517],{},[1033,1479,1480,1481,684],{"name":1470,"type":1076},"Text block id; deltas sharing an id are merged into one block. Omitted deltas go to the default block ",[241,1482,1483],{},"'text-1'",[1033,1485,1487,1488,1491],{"name":1486,"type":1076},"delta","Incremental text for this chunk; empty means no ",[241,1489,1490],{},"text-delta"," is emitted.",[1033,1493,1496],{"name":1494,"type":1495},"end","boolean","Closes that text block.",[1033,1498,1501,1502,1505,1506,1509,1510,1157,1513,1516],{"name":1499,"type":1500},"data","{ type: string, value: unknown, transient?: boolean }","An extra custom data part, emitted as ",[241,1503,1504],{},"data-${type}",". With ",[241,1507,1508],{},"transient: true"," it only reaches ",[241,1511,1512],{},"useChat",[241,1514,1515],{},"onData"," callback and is never written to message history.",[1033,1518,1520],{"name":1519,"type":1495},"finished","Ends the whole stream; later chunks are ignored.",[209,1522,1523,1524,1526],{},"Workflow-style gateways often carry node information alongside the answer. Route it through a ",[241,1525,1499],{}," part to drive progress without polluting the message history:",[265,1528,1530],{"className":700,"code":1529,"language":702,"meta":270,"style":270},"const transport = createChatTransport\u003CGatewayChunk>({\n  api: '\u002Fchat\u002Fcompletions',\n  select: raw => ({\n    id: raw.runtime_node_id,\n    delta: raw.content,\n    end: raw.node_is_end,\n    finished: raw.is_end,\n    data: { type: 'node', value: { nodeId: raw.node_id, nodeIsEnd: raw.node_is_end }, transient: true }\n  })\n})\n\nconst { messages } = useChat({\n  transport,\n  onData: (part) => {\n    if (part.type === 'data-node') advanceStage(part.data)\n  }\n})\n",[241,1531,1532,1548,1556,1568,1572,1576,1580,1585,1601,1605,1609,1613,1630,1635,1654,1675,1679],{"__ignoreMap":270},[216,1533,1534,1536,1538,1540,1542,1544,1546],{"class":275,"line":276},[216,1535,358],{"class":307},[216,1537,1325],{"class":327},[216,1539,364],{"class":307},[216,1541,1330],{"class":287},[216,1543,280],{"class":279},[216,1545,1335],{"class":287},[216,1547,1338],{"class":279},[216,1549,1550,1552,1554],{"class":275,"line":304},[216,1551,1343],{"class":279},[216,1553,1346],{"class":297},[216,1555,1349],{"class":279},[216,1557,1558,1560,1562,1564,1566],{"class":275,"line":317},[216,1559,1354],{"class":287},[216,1561,854],{"class":279},[216,1563,1359],{"class":320},[216,1565,860],{"class":307},[216,1567,1364],{"class":279},[216,1569,1570],{"class":275,"line":331},[216,1571,1369],{"class":279},[216,1573,1574],{"class":275,"line":342},[216,1575,1374],{"class":279},[216,1577,1578],{"class":275,"line":348},[216,1579,1379],{"class":279},[216,1581,1582],{"class":275,"line":355},[216,1583,1584],{"class":279},"    finished: raw.is_end,\n",[216,1586,1587,1590,1593,1596,1598],{"class":275,"line":379},[216,1588,1589],{"class":279},"    data: { type: ",[216,1591,1592],{"class":297},"'node'",[216,1594,1595],{"class":279},", value: { nodeId: raw.node_id, nodeIsEnd: raw.node_is_end }, transient: ",[216,1597,1077],{"class":327},[216,1599,1600],{"class":279}," }\n",[216,1602,1603],{"class":275,"line":422},[216,1604,1389],{"class":279},[216,1606,1607],{"class":275,"line":427},[216,1608,1394],{"class":279},[216,1610,1611],{"class":275,"line":442},[216,1612,352],{"emptyLinePlaceholder":351},[216,1614,1615,1617,1619,1621,1623,1625,1627],{"class":275,"line":453},[216,1616,358],{"class":307},[216,1618,384],{"class":279},[216,1620,1407],{"class":327},[216,1622,406],{"class":279},[216,1624,294],{"class":307},[216,1626,1432],{"class":287},[216,1628,1629],{"class":279},"({\n",[216,1631,1632],{"class":275,"line":458},[216,1633,1634],{"class":279},"  transport,\n",[216,1636,1637,1640,1643,1646,1649,1652],{"class":275,"line":501},[216,1638,1639],{"class":287},"  onData",[216,1641,1642],{"class":279},": (",[216,1644,1645],{"class":320},"part",[216,1647,1648],{"class":279},") ",[216,1650,1651],{"class":307},"=>",[216,1653,314],{"class":279},[216,1655,1656,1659,1662,1664,1667,1669,1672],{"class":275,"line":513},[216,1657,1658],{"class":307},"    if",[216,1660,1661],{"class":279}," (part.type ",[216,1663,572],{"class":307},[216,1665,1666],{"class":297}," 'data-node'",[216,1668,1648],{"class":279},[216,1670,1671],{"class":287},"advanceStage",[216,1673,1674],{"class":279},"(part.data)\n",[216,1676,1677],{"class":275,"line":519},[216,1678,516],{"class":279},[216,1680,1681],{"class":275,"line":524},[216,1682,1394],{"class":279},[234,1684,1686],{"id":1685},"request-orchestration","Request orchestration",[209,1688,1689,390,1691,390,1693,390,1695,390,1698,1701,1702,1705,1706,1708,1709,1711,1712,324],{},[241,1690,1018],{},[241,1692,1123],{},[241,1694,1120],{},[241,1696,1697],{},"credentials",[241,1699,1700],{},"prepareSendMessagesRequest"," and ",[241,1703,1704],{},"prepareReconnectToStreamRequest"," are the AI SDK ",[241,1707,1182],{}," options and behave identically. A private handshake (open a session first, then build the stream URL) belongs in ",[241,1710,1700],{},", which may be async and may override ",[241,1713,1018],{},[265,1715,1717],{"className":700,"code":1716,"language":702,"meta":270,"style":270},"const transport = createChatTransport\u003CGatewayChunk>({\n  prepareSendMessagesRequest: async ({ messages }) => {\n    const chatId = await $api\u003Cstring>('\u002Fchat\u002Fopen')\n\n    return {\n      api: `\u002Fchat_message\u002F${chatId}`,\n      body: { message: getTextFromMessage(messages.at(-1)!) }\n    }\n  },\n  select\n})\n",[241,1718,1719,1735,1756,1782,1786,1793,1809,1840,1845,1850,1855],{"__ignoreMap":270},[216,1720,1721,1723,1725,1727,1729,1731,1733],{"class":275,"line":276},[216,1722,358],{"class":307},[216,1724,1325],{"class":327},[216,1726,364],{"class":307},[216,1728,1330],{"class":287},[216,1730,280],{"class":279},[216,1732,1335],{"class":287},[216,1734,1338],{"class":279},[216,1736,1737,1740,1742,1744,1747,1749,1752,1754],{"class":275,"line":304},[216,1738,1739],{"class":287},"  prepareSendMessagesRequest",[216,1741,854],{"class":279},[216,1743,430],{"class":307},[216,1745,1746],{"class":279}," ({ ",[216,1748,1407],{"class":320},[216,1750,1751],{"class":279}," }) ",[216,1753,1651],{"class":307},[216,1755,314],{"class":279},[216,1757,1758,1761,1764,1766,1768,1771,1773,1775,1777,1780],{"class":275,"line":317},[216,1759,1760],{"class":307},"    const",[216,1762,1763],{"class":327}," chatId",[216,1765,364],{"class":307},[216,1767,464],{"class":307},[216,1769,1770],{"class":287}," $api",[216,1772,280],{"class":279},[216,1774,1076],{"class":327},[216,1776,964],{"class":279},[216,1778,1779],{"class":297},"'\u002Fchat\u002Fopen'",[216,1781,376],{"class":279},[216,1783,1784],{"class":275,"line":331},[216,1785,352],{"emptyLinePlaceholder":351},[216,1787,1788,1791],{"class":275,"line":342},[216,1789,1790],{"class":307},"    return",[216,1792,314],{"class":279},[216,1794,1795,1798,1801,1804,1807],{"class":275,"line":348},[216,1796,1797],{"class":279},"      api: ",[216,1799,1800],{"class":297},"`\u002Fchat_message\u002F${",[216,1802,1803],{"class":279},"chatId",[216,1805,1806],{"class":297},"}`",[216,1808,1349],{"class":279},[216,1810,1811,1814,1817,1820,1823,1825,1828,1831,1834,1837],{"class":275,"line":355},[216,1812,1813],{"class":279},"      body: { message: ",[216,1815,1816],{"class":287},"getTextFromMessage",[216,1818,1819],{"class":279},"(messages.",[216,1821,1822],{"class":287},"at",[216,1824,370],{"class":279},[216,1826,1827],{"class":307},"-",[216,1829,1830],{"class":327},"1",[216,1832,1833],{"class":279},")",[216,1835,1836],{"class":307},"!",[216,1838,1839],{"class":279},") }\n",[216,1841,1842],{"class":275,"line":379},[216,1843,1844],{"class":279},"    }\n",[216,1846,1847],{"class":275,"line":422},[216,1848,1849],{"class":279},"  },\n",[216,1851,1852],{"class":275,"line":427},[216,1853,1854],{"class":279},"  select\n",[216,1856,1857],{"class":275,"line":442},[216,1858,1394],{"class":279},[234,1860,1862],{"id":1861},"why-the-default-fetch-goes-through-api","Why the default fetch goes through $api",[209,1864,1865,1866,1869,1870,1872,1873,1876,1877,1883,1884,1887,1888,1890,1891,1157,1893,684],{},"The injected default ",[241,1867,1868],{},"fetch"," is backed by ",[241,1871,153],{},", so endpoint baseURL, auth headers, business-code validation, error toasts and the ",[241,1874,1875],{},"movk:api:*"," hooks all apply. That is not only convenience: ",[674,1878,1879,1880,1882],{},"some gateways return errors as HTTP 200 with a ",[241,1881,739],{}," envelope",", which any ",[241,1885,1886],{},"response.ok"," check happily lets through before reading JSON as a stream and spinning forever. Through ",[241,1889,153],{}," such a response throws at the business-code check and lands in ",[241,1892,1512],{},[241,1894,787],{},[209,1896,1897,1898,1900,1901,1903,1904,1906,1907,1912],{},"It also takes care of ",[241,1899,692],{},": ofetch adds ",[241,1902,688],{}," whenever the body is JSON, which is the wrong claim for a stream, so the default is switched to the wildcard. An explicit ",[241,1905,1123],{}," entry always wins. See ",[245,1908,1910],{"href":1909},"\u002Fen\u002Fdocs\u002Fapi\u002Fstream#how-accept-and-responsetype-are-handled",[241,1911,232],{}," for the details.",[209,1914,1915,1916,1918,1919,1921],{},"Passing your own ",[241,1917,1868],{}," overrides the default, ",[241,1920,692],{}," included.",[234,1923,145],{"id":1924},"api-1",[1020,1926,1928],{"id":1927},"createchattransport-1","createChatTransport()",[1025,1930,1028],{"id":1931},"type-parameters-1",[1030,1933,1934,1938],{},[1033,1935,1937],{"name":1936,"type":1036},"Raw","Type of a single backend chunk.",[1033,1939,1941,1942,684],{"name":1940,"type":1164},"UI_MESSAGE","Message type; defaults to the AI SDK ",[241,1943,1164],{},[1025,1945,1070],{"id":1946},"parameters",[1030,1948,1949],{},[1033,1950,1952],{"name":1080,"type":1951,":required":1077},"MovkChatTransportOptions\u003CRaw, UI_MESSAGE>",[1083,1953,1954],{},[1030,1955,1956,1960,1964,1971],{},[1033,1957,1959],{"name":1178,"type":1958,":required":1077},"(raw: Raw) => UIChunkSelection | undefined","Pure mapping from a backend chunk to UI parts.",[1033,1961,1090,1962,684],{"name":1089,"type":1076},[241,1963,1093],{},[1033,1965,1098,1967,1102,1969,684],{"name":1096,"type":1966},"(data: string) => Raw | undefined",[241,1968,1101],{},[241,1970,1105],{},[1033,1972,1975,390,1977,390,1979,390,1981,390,1983,390,1985,390,1987,1989],{"name":1973,"type":1974},"...HttpChatTransportInitOptions","HttpChatTransportInitOptions",[241,1976,1018],{},[241,1978,1123],{},[241,1980,1120],{},[241,1982,1697],{},[241,1984,1868],{},[241,1986,1700],{},[241,1988,1704],{}," — same semantics as the AI SDK.",[1025,1991,1041],{"id":1992},"returns-1",[209,1994,1995,1998,1999,684],{},[241,1996,1997],{},"ChatTransport\u003CUI_MESSAGE>",", ready to hand to ",[241,2000,2001],{},"useChat({ transport })",[234,2003,1142],{"id":2004},"changelog-1",[1144,2006],{"prefix":2007,"suffix":702,"casing":2008},"domains\u002Fai","kebab",[2010,2011,2012],"style",{},"html pre.shiki code .sxrX7, html code.shiki .sxrX7{--shiki-light:#24292E;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sovSZ, html code.shiki .sovSZ{--shiki-light:#22863A;--shiki-default:#22863A;--shiki-dark:#85E89D}html pre.shiki code .snPdu, html code.shiki .snPdu{--shiki-light:#6F42C1;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sIIMD, html code.shiki .sIIMD{--shiki-light:#032F62;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .s8jYJ, html code.shiki .s8jYJ{--shiki-light:#D73A49;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sP4rz, html code.shiki .sP4rz{--shiki-light:#E36209;--shiki-default:#E36209;--shiki-dark:#FFAB70}html pre.shiki code .sBjJW, html code.shiki .sBjJW{--shiki-light:#005CC5;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sCsY4, html code.shiki .sCsY4{--shiki-light:#6A737D;--shiki-default:#6A737D;--shiki-dark:#6A737D}",{"title":270,"searchDepth":304,"depth":304,"links":2014},[2015,2023],{"id":231,"depth":304,"text":232,"children":2016},[2017,2018,2019,2020,2021,2022],{"id":236,"depth":317,"text":237},{"id":665,"depth":317,"text":666},{"id":746,"depth":317,"text":747},{"id":902,"depth":317,"text":250},{"id":1018,"depth":317,"text":145},{"id":1141,"depth":317,"text":1142},{"id":1149,"depth":304,"text":1014,"children":2024},[2025,2026,2027,2028,2029,2030],{"id":1152,"depth":317,"text":237},{"id":1455,"depth":317,"text":1456},{"id":1685,"depth":317,"text":1686},{"id":1861,"depth":317,"text":1862},{"id":1924,"depth":317,"text":145},{"id":2004,"depth":317,"text":1142},"md",{},{"title":173,"description":176},{"loc":174},"v9qSw6Ni5778AqSkDHpUulKYp03a3Fwye1GbyB4_UfA",[2037,2038],{"title":168,"path":169,"stem":170,"description":171,"children":-1},{"title":185,"path":186,"stem":187,"description":189,"children":-1},{"data":2040,"body":2041},{},{"type":205,"children":2042},[2043],{"type":208,"tag":209,"props":2044,"children":2045},{},[2046],{"type":213,"value":176},1795419759578]