Skip to content

Commit

Permalink
fix ts compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Nico Ramirez committed Nov 15, 2023
1 parent bb9741f commit 91d0841
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 8 deletions.
53 changes: 53 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
"@trpc/next": "^10.43.3",
"@trpc/react-query": "^10.43.3",
"@trpc/server": "^10.43.3",
"@types/gapi": "^0.0.47",
"@types/gapi.client.bigquery": "^2.0.4",
"@types/google.accounts": "^0.0.14",
"@vercel/analytics": "^1.1.1",
"ag-grid-community": "^30.2.1",
"ag-grid-enterprise": "^30.2.1",
Expand Down
2 changes: 1 addition & 1 deletion pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default function MyDocument({ emotionStyleTags }: MyDocumentProps) {
{/* Style Sheets (injected and server-side) */}
<meta name='emotion-insertion-point' content='' />

<script src="https://apis.google.com/js/api.js"></script>
<script src="https://apis.google.com/js/api.js" async></script>
<script src="https://accounts.google.com/gsi/client" async defer></script>
{emotionStyleTags}
</Head>
Expand Down
1 change: 0 additions & 1 deletion src/apps/chat/AppChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ export function AppChat() {
conversationId={activeConversationId} messageId={null}
isDeveloperMode={systemPurposeId === 'Developer'}
onNewMessage={handleComposerNewMessage}
bigQueryResult={bigQueryResult}
sx={{
zIndex: 21, // position: 'sticky', bottom: 0,
backgroundColor: 'background.surface',
Expand Down
15 changes: 10 additions & 5 deletions src/apps/chat/components/message/RenderCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ const PROJECT_ID = 'symbiosys-prod';
const PAGE_SIZE = 100;

// TODO: move this to an external hook for cleaner code
const useAccessTokenStore = create(persist(
interface AccessTokenStoreState {
accessToken: string | null;
setAccessToken: (accessToken: string) => void;
}
const useAccessTokenStore = create<AccessTokenStoreState>()(persist(
(set) => ({
accessToken: null,
setAccessToken: (accessToken: string) => set({ accessToken }),
Expand Down Expand Up @@ -160,11 +164,11 @@ function RenderCodeImpl(props: {
const tokenClientRef = React.useRef(google.accounts.oauth2.initTokenClient({
client_id: '361681009781-hns0m7bb5t9s09bb613vvuenr9t8o55a.apps.googleusercontent.com',
scope: 'https://www.googleapis.com/auth/bigquery',
// callback: handleCredentialResponse
callback: () => null
}));
const tokenClient = tokenClientRef.current;

const getToken = async (err, isInitial = false) => {
const getToken = async (err: any, isInitial = false) => {
if (isInitial) {
// spoof error to trigger token request
err = { result: { error: { code: 401 } } };
Expand All @@ -174,6 +178,7 @@ function RenderCodeImpl(props: {
await new Promise((resolve, reject) => {
try {
// Settle this promise in the response callback for requestAccessToken()
// @ts-ignore
tokenClient.callback = (resp) => {
console.log('tokenClient.callback', resp);
console.log(resp.error !== undefined)
Expand Down Expand Up @@ -235,7 +240,7 @@ function RenderCodeImpl(props: {
'jobId': jobId,
'maxResults': PAGE_SIZE,
'timeoutMs': 180000, // we never want to deal with the job id, almost any query is faster than 3 min
'startIndex': startRow,
'startIndex': startRow ? '' + startRow : undefined,
});

const getQueryResultsWithRetry = async (startRow: number | null = null) => {
Expand All @@ -261,7 +266,7 @@ function RenderCodeImpl(props: {
return nextPageResults; // Return the next page of results
};
// Execute the initial query and get the first page of results
const resp = await queryWithRetry();
const resp: any = await queryWithRetry();
jobId = resp.result.jobReference.jobId;
location = resp.result.jobReference.location;

Expand Down
1 change: 1 addition & 0 deletions src/apps/link/ViewChatLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export function ViewChatLink(props: { conversation: DConversation, storedAt: Dat
key={'msg-' + message.id} message={message}
showDate={idx === 0 || idx === filteredMessages.length - 1}
onMessageEdit={text => message.text = text}
setBigQueryResult={() => null}
/>,
)}

Expand Down
1 change: 1 addition & 0 deletions src/modules/aifn/digrams/DiagramsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ export function DiagramsModal(props: { config: DiagramConfig, onClose: () => voi
message={message} hideAvatars noBottomBorder noMarkdown filterOnlyCode
codeBackground='background.surface'
onMessageEdit={(text) => setMessage({ ...message, text })}
setBigQueryResult={() => null}
sx={{
backgroundColor: abortController ? 'background.level3' : 'background.level2',
marginX: 'calc(-1 * var(--Card-padding))',
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"~/common/*": ["src/common/*"],
"~/modules/*": ["src/modules/*"],
"~/server/*": ["src/server/*"]
}
},
"typeRoots": ["node_modules/@types"]
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
Expand Down

0 comments on commit 91d0841

Please sign in to comment.