-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add the auto complete for the bot config (#584)
仓库配置支持选择已有仓库,输入仓库地址或仓库名称 ![image](https://github.com/user-attachments/assets/f572d859-1fcd-4735-8b81-59e4f4836c28) ![image](https://github.com/user-attachments/assets/95b7e530-6405-479d-8823-721d92047ff0)
- Loading branch information
Showing
12 changed files
with
178 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,33 @@ | ||
import { useUser as useAssistUser } from '@petercatai/assistant'; | ||
import { useFingerprint } from './useFingerprint'; | ||
import { useQuery } from '@tanstack/react-query'; | ||
import { getUserRepos } from '../services/UserController'; | ||
import { map } from 'lodash'; | ||
|
||
const API_DOMAIN = process.env.NEXT_PUBLIC_API_DOMAIN!; | ||
|
||
export default function useUser() { | ||
export const useUser = () => { | ||
const { data: fingerprint } = useFingerprint(); | ||
const { user, isLoading, actions } = useAssistUser({ | ||
apiDomain: API_DOMAIN, | ||
fingerprint: fingerprint?.visitorId! | ||
fingerprint: fingerprint?.visitorId!, | ||
}); | ||
|
||
return { | ||
user, | ||
isLoading, | ||
actions, | ||
status: isLoading ? "pending" : 'success', | ||
status: isLoading ? 'pending' : 'success', | ||
}; | ||
} | ||
}; | ||
|
||
export const useUserRepos = (enabled: boolean) => { | ||
return useQuery({ | ||
queryKey: [`user.repos`], | ||
queryFn: async () => getUserRepos(), | ||
enabled, | ||
select: (data) => | ||
map(data.data, (item) => ({ label: item.name, key: item.name })), | ||
retry: true, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.