안녕하세요! 다이나믹 페이지에서 데이터 패칭이 오래 걸리는 문제를 해결하기 위해, Next에서 임시로 로딩 UI를 보여주고, 추후 패칭이 완료되면 스트리밍으로 업데이트하는 것으로 이해했습니다. 로딩 UI는 데이터 패칭이 느릴 때 유용하지만, 패칭이 빠른 경우 오히려 깜빡거리는 느낌이 들어 사용자 경험 측면에서 안 좋을 수 있다고 느꼈습니다. 물론 제가 생각했을 때 가장 베스트는 API 속도를 측정하여 특정 시간 이상인 경우에 스트리밍 기술을 적용하고, 그 외에는 안하는 것이 좋다고 생각을 했지만, 측정하기도 힘들 뿐더러, 사용자 네트워크도 신경을 써야 하기 때문에 이러한 방법은 어렵다고 생각을 했습니다. 이러한 문제에서 강사님의 생각을 듣고 싶어 질문드리게 되었습니다.
초보자를 위한 ChatGPT API 활용법 - API 기본 문법부터 12가지 프로그램 제작 배포까지
계속해서 인터프리터를 찾지 못해서 루트 경로에 .vscode폴더를 만들고 settings.json파일을 생성후, { "python.defaultInterpreterPath": "${workspaceFolder}/ch02_env/bin/python" } 해당 코드를 넣어 강제로 인식하게 했는데, 인터프리터 인식이 되었습니다..
안녕하세요! 클라이언트 라우터 캐시 기능에 대해 궁금증이 있어서 질문합니다. 클라이언트 라우터 캐시에 공통적으로 쓰이고 변하지 않는? 레이아웃들을 캐싱한다고 이해했습니다. 제가 궁금한 것은 RSC Payload는 수시로 바뀔 수 있을 것 같아 라우터 캐시에 저장하기 어렵겠지만, JS Bundle은 클라이언트 컴포넌트들로 구성되어 있다면 변하지 않으므로 캐싱해도 되지 않을까 생각을 해봤습니다.
안녕하세요! 풀 라우트 캐시 이후 JS Bundle, RSC Payload도 불러오는지 궁금해서 질문해봅니다. Next Link를 통해 페이지를 교체할 때, Next 서버는 JS Bundle과 RSC Payload를 클라이언트로 전송하고, 클라이언트는 이를 적절히 결합하여 페이지를 렌더링하는 것으로 이해했습니다. 만약 초기 접속 시 풀 라우트 캐시되어 있는 static html를 불러온 이후, JS Bundle, RSC Payload도 불러오는지 궁금합니다. 그리고 초기 접속 시 다이나믹 페이지 또한 html을 불러온 이후, JS Bundle, RSC Payload도 불러오는지 궁금합니다. 제 생각은 불러올 것 같지만, 확실히 알면 좋을 것 같아서 질문드려봅니다.
안녕하세요! build할 때 계속해서 type 오류가 발생하여 질문 드립니다. 현재 page.tsx에는 아래와 같이 작성되어 있습니다. import BookItem from "@/components/book-item"; import { BookData } from "@/types"; export default async function Page({ searchParams, }: { searchParams: { q?: string; }; }) { const response = await fetch( `${process.env.NEXT_PUBLIC_API_SERVER_URL}/book/search?q=${searchParams.q}` ); if (!response.ok) { return <div>오류가 발생했습니다...</div>; } const books: BookData[] = await response.json(); return ( <div> {books.map((book) => ( <BookItem key={book.id} {...book} /> ))} </div> ); } 근데 여기서 build를 하면 아래와 같은 에러가 발생합니다. .next/types/app/(with-searchbar)/search/page.ts:34:29 Type error: Type 'Props' does not satisfy the constraint 'PageProps'. Types of property 'searchParams' are incompatible. Type 'Record<string, string | string[]> | undefined' is not assignable to type 'Promise<any> | undefined'. Type 'Record<string, string | string[]>' is missing the following properties from type 'Promise<any>': then, catch, finally, [Symbol.toStringTag] 32 | 33 | // Check the prop type of the entry function > 34 | checkFields<Diff<PageProps, FirstArg<TEntry['default']>, 'default'>>() | ^ 35 | 36 | // Check the arguments and return type of the generateMetadata function 37 | if ('generateMetadata' in entry) { Next.js build worker exited with code: 1 and signal: null 사실 gpt를 이용하여 받은 코드로 작성해보면 에러를 해결할 수는 있는데 이게 근본적인 해결 방법인지 잘 모르겠고, gpt가 작성한 코드가 잘 이해가 되지 않습니다. 우선 gpt에서 받은 답변은 아래와 같습니다. import BookItem from "@/components/book-item"; import { BookData } from "@/types"; export default async function Page({ searchParams }: any) { const qRaw = searchParams?.q; const q = Array.isArray(qRaw) ? qRaw[0] : qRaw ?? ""; const response = await fetch( `${process.env.NEXT_PUBLIC_API_SERVER_URL}/book/search?q=${encodeURIComponent(q)}` ); if (!response.ok) { return <div>오류가 발생했습니다...</div>; } const books: BookData[] = await response.json(); return ( <div> {books.map((book) => ( <BookItem key={book.id} {...book} /> ))} </div> ); } 이렇게 하면 해결은 되긴합니다. 다만 왜 해결이 되는 건지 이해가 잘 되지 않아서 그런데 왜 자꾸 build할 때 type 오류가 발생하는지 알려주시면 감사드리겠습니다!
버젼이 달라서인지.. CNA 했을 때 tailwind.config.js 파일이 없었습니다. 강의에서는 원래부터 존재하던데.. 그래서 어떻게어떻게 추가를 했는데. Error: It looks like you're trying to use tailwindcss directly as a PostCSS plugin. The PostCSS plugin has moved to a separate package, so to continue using Tailwind CSS with PostCSS you'll need to install @tailwindcss/postcss and update your PostCSS configuration. 라는 에러가 끝나지를 않네요 ㅠ GPT한테 열심히 물어봤는데 도저히 해결이 안돼서 문의드립니다. 밑은 제가 설정해둔 코드입니다. tailwind.config.js /** @type {import('tailwindcss').Config} */ module.exports = { content: [ "./src/**/*.{js,ts,jsx,tsx,html,css}", // 필요한 파일들 포함 "./app/**/*.{js,ts,jsx,tsx}", // Next.js의 `app` 폴더 추가 "./components/**/*.{js,ts,jsx,tsx}", // 컴포넌트 폴더 추가 ], theme: { extend: { colors: { 철수가좋아하는색깔: "#3498db", // 나만의 부트스트랩 만들기 영희가좋아하는색깔: "green", }, }, }, plugins: [], }; postcss.config.js module.exports = { plugins: { tailwindcss: {}, autoprefixer: {}, }, }; globals.css /* @import "tailwindcss"; */ @tailwind base; @tailwind components; @tailwind utilities; 로 해도 안되고, @import "tailwindcss"; 도 안됩니다...
from langchain.retrievers.document_compressors import DocumentCompressorPipeline from langchain_community.document_transformers import EmbeddingsRedundantFilter # 중복 문서 제거 redundant_filter = EmbeddingsRedundantFilter(embeddings=embeddings_model) # 쿼리와 관련성이 높은 문서만 필터링 relevant_filter = EmbeddingsFilter(embeddings=embeddings_model, similarity_threshold=0.5) # Re-ranking re_ranker = LLMListwiseRerank.from_llm(llm, top_n=2) pipeline_compressor = DocumentCompressorPipeline( transformers=[redundant_filter, relevant_filter, re_ranker] ) pipeline_compression_retriever = ContextualCompressionRetriever( base_compressor=pipeline_compressor, base_retriever=chroma_db.as_retriever() ) question = "테슬라 회장은 누구인가요?" compressed_docs = pipeline_compression_retriever.invoke(question) print(f"쿼리: {question}") print("검색 결과:") for doc in compressed_docs: print(f"- {doc.page_content} [출처: {doc.metadata['source']}]") print("-"*100) print() `(4) DocumentCompressorPipeline` - 여러 압축기를 순차적으로 결합하는 방식 - BaseDocumentTransformers를 추가하여, 문서를 더 작은 조각으로 나누거나 중복 문서를 제거하는 등의 작업도 가능 여기에서 result = chain.invoke() 로 받아서 result의 데이터를 보면, context = result['context'][i] query_similarity_score = context.state['query_similarity_score'] 이렇게 similarity_score 처럼 rerank score같은거 보고싶은데, # 크로스 인코더를 사용하여 유사성 점수를 계산합니다. sentence_pairs = [[query, prediction]] similarity_scores = cross_encoder_model.predict(sentence_pairs) 이런식으로 계산을 해야하나요? 추출하고 싶은데 방법을 잘 모르겠습니다.
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 갑자기 선수강의에 없었던 정적페이지크롤링 파일이 나오는데 이건 어떻게 해야 하나요. 어디서 참고해야 하나요
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 안녕하세요, 리액트 학습 중에 궁금한 게 있어서 질문드려요. 기본 path 가 아닌 라우트로 바로 접속을 할때, html을 받으면 라우팅이 이뤄지구 useeffect로 api 요청이 가면서 페이지 렌더링이 이뤄지는건가요?
getPostRecommend() 함수 내부에서 tags : ['post', 'recommends'] 로 설정이 되어있는데, queryClient.prefetch 함수나, useQuery 함수의 queryKey와 항상 동일하게 일치시켜야 하나요? 불러온 데이터를 캐싱할 경우, react-query에서만 관리를 키를 관리해도 되지 않을까요?