File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,14 +42,15 @@ export async function POST(request: Request) {
4242 experimental_transform : smoothStream ( { chunking : "word" } ) ,
4343 prompt : message ,
4444 abortSignal : request . signal ,
45- onFinish : ( ctx ) => {
46- chatRepository
47- . upsertThread ( {
48- id : threadId ,
49- title : ctx . text ,
50- userId : session . user . id ,
51- } )
52- . catch ( ( err ) => logger . error ( err ) ) ;
45+ onFinish : async ( ctx ) => {
46+ const title = ctx . text . trim ( ) ;
47+ if ( ! title ) return ;
48+
49+ await chatRepository . upsertThread ( {
50+ id : threadId ,
51+ title,
52+ userId : session . user . id ,
53+ } ) ;
5354 } ,
5455 } ) ;
5556
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ export function useGenerateThreadTitle(option: {
1818 const updateTitle = useCallback (
1919 ( title : string ) => {
2020 appStore . setState ( ( prev ) => {
21- if ( prev . threadList . some ( ( v ) => v . id ! == option . threadId ) ) {
21+ if ( ! prev . threadList . some ( ( v ) => v . id = == option . threadId ) ) {
2222 return {
2323 threadList : [
2424 {
You can’t perform that action at this time.
0 commit comments