Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sweep: add ApolloClient type to client.tsx #8

Closed
2 tasks done
FreePhoenix888 opened this issue Sep 11, 2023 · 11 comments
Closed
2 tasks done

Sweep: add ApolloClient type to client.tsx #8

FreePhoenix888 opened this issue Sep 11, 2023 · 11 comments
Labels
sweep Sweep your software chores

Comments

@FreePhoenix888
Copy link
Member

FreePhoenix888 commented Sep 11, 2023

): ApolloClient<any> {
uses ApolloClient from @apollo/client, we should use our own ApolloClient type that should be created and should look like this:

import { ApolloClient as  BaseApolloClient} from '@apollo/client';
export type ApolloClient = BaseApolloClient<any> & {
  path: string;
  ssl: boolean;
  jwt_token: string;
}

Instead of using new ApolloClient use new BaseApolloClient (because new ApolloClient is just a type/interface, not a class

Checklist
• At the top of the file, import ApolloClient from @apollo/client. • Create a new type called ApolloClient that extends the ApolloClient from @apollo/client and adds a path property of type string and an SSL property of type boolean. • Replace all instances of ApolloClient from @apollo/client with the new custom ApolloClient type.
Checklist
• At the top of the file, import ApolloClient from '@apollo/client' as BaseApolloClient. • Create a new type called ApolloClient that extends the BaseApolloClient from '@apollo/client' and adds a 'path' property of type string, an 'ssl' property of type boolean, and a 'jwt_token' property of type string. • Replace the ApolloClient in the 'IApolloClient' interface with the new custom ApolloClient type. • Replace the ApolloClient in the return type of the 'generateApolloClient' function with the new custom ApolloClient type. • Replace the 'new ApolloClient' in the 'generateApolloClient' function with 'new BaseApolloClient'.
@deep-foundation-sweepai deep-foundation-sweepai bot added the sweep Sweep your software chores label Sep 11, 2023
@deep-foundation-sweepai
Copy link

deep-foundation-sweepai bot commented Sep 11, 2023

16%


❌ Unable to Complete PR

I'm sorry, but it looks like an error has occurred. Try changing the issue description to re-trigger Sweep. If this error persists contact [email protected].

For bonus GPT-4 tickets, please report this bug on Discord.


🎉 Latest improvements to Sweep:

  • Use Sweep Map to break large issues into smaller sub-issues, perfect for large tasks like "Sweep (map): migrate from React class components to function components"
  • Getting Sweep to format before committing! Check out Sweep Sandbox Configs to set it up.
  • We released a demo of our chunker, where you can find the corresponding blog and code.

💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request.

@kevinlu1248
Copy link

sweep: Retry

@deep-foundation-sweepai
Copy link

deep-foundation-sweepai bot commented Sep 11, 2023

Here's the PR! #12.

💎 Sweep Pro: I used GPT-4 to create this ticket. You have unlimited GPT-4 tickets. To retrigger Sweep, edit the issue.


Step 1: 📍 Planning

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I looked at (click to expand). If some file is missing from here, you can mention the path in the ticket description.

hasura/client.tsx

Lines 1 to 133 in 202846e

import { HttpLink, InMemoryCache, ApolloClient } from '@apollo/client';
import { getMainDefinition } from '@apollo/client/utilities';
import { ApolloLink, concat, split } from 'apollo-link';
import { WebSocketLink } from 'apollo-link-ws';
import fetch from 'node-fetch';
import path from 'path';
import Debug from 'debug';
const debug = Debug('hasura:client');
let ws;
if (typeof(window) !== 'object') {
ws = require('ws');
}
const DEEP_FOUNDATION_HASURA_RELATIVE: boolean | undefined = ((r) => r ? !!+r : undefined)(process.env.DEEP_FOUNDATION_HASURA_RELATIVE);
const NEXT_PUBLIC_DEEP_FOUNDATION_HASURA_RELATIVE: boolean | undefined = ((r) => r ? !!+r : undefined)(process.env.NEXT_PUBLIC_DEEP_FOUNDATION_HASURA_RELATIVE);
const ENV_RELATIVE = typeof(DEEP_FOUNDATION_HASURA_RELATIVE) === 'boolean' ? DEEP_FOUNDATION_HASURA_RELATIVE : typeof(NEXT_PUBLIC_DEEP_FOUNDATION_HASURA_RELATIVE) === 'boolean' ? NEXT_PUBLIC_DEEP_FOUNDATION_HASURA_RELATIVE : undefined;
export interface IApolloClientGeneratorOptions {
initialStore?: any;
token?: string;
client?: string;
secret?: string;
ssl?: boolean;
path?: string;
headers?: any;
ws?: boolean;
relative?: boolean;
}
export function generateHeaders(options: IApolloClientGeneratorOptions) {
const headers: IApolloClientGeneratorOptions['headers'] = { ...options.headers };
if (options.token) headers.Authorization = `Bearer ${options.token}`;
if (options.secret) headers['x-hasura-admin-secret'] = options.secret;
if (options.client) headers['x-hasura-client'] = options.client;
return headers;
}
export interface IApolloClient<T> extends ApolloClient<T> {
jwt_token?: string;
path?: string;
ssl?: boolean;
}
const host = typeof(window) === 'object' ? window.location.host : '';
export function generateApolloClient(
options: IApolloClientGeneratorOptions,
forwardingArguments?: {
ApolloClient?: any;
InMemoryCache?: any;
},
): ApolloClient<any> {
debug('generateApolloClient', options, forwardingArguments);
const isRelative = typeof(options?.relative) === 'boolean' ? options.relative : typeof(ENV_RELATIVE) === 'boolean' ? ENV_RELATIVE : false;
const headers = generateHeaders(options);
const httpLink = new HttpLink({
uri: `${isRelative ? '' : `http${options.ssl ? 's' : ''}:/`}${path.normalize('/' + (options.path || ''))}`,
// @ts-ignore
fetch,
headers,
});
const wsLink = options.ws
? new WebSocketLink({
uri: `${isRelative ? (host ? `ws${options.ssl ? 's' : ''}://${host}` : '') : `ws${options.ssl ? 's' : ''}:/`}${path.normalize('/' + (options.path || ''))}`,
options: {
lazy: true,
reconnect: true,
connectionParams: () => ({
headers,
}),
},
webSocketImpl: ws,
})
: null;
const authMiddleware = new ApolloLink((operation, forward) => {
operation.setContext({
headers,
});
return forward(operation);
});
const link = !options.ws
? httpLink
: split(
({ query }) => {
// return true;
// if you need ws only for subscriptions:
const def = getMainDefinition(query);
return def?.kind === 'OperationDefinition' && def?.operation === 'subscription';
},
wsLink,
// @ts-ignore
httpLink,
);
const client: IApolloClient<any> = new ApolloClient({
ssrMode: true,
// @ts-ignore
link: concat(authMiddleware, link),
connectToDevTools: true,
cache: new InMemoryCache({
...forwardingArguments?.InMemoryCache,
freezeResults: false,
resultCaching: false,
}).restore(options.initialStore || {}),
...forwardingArguments?.ApolloClient,
defaultOptions: {
watchQuery: {
fetchPolicy: 'no-cache',
// errorPolicy: 'ignore',
...forwardingArguments?.ApolloClient?.defaultOptions?.watchQuery,
},
query: {
fetchPolicy: 'no-cache',
// errorPolicy: 'ignore',
...forwardingArguments?.ApolloClient?.defaultOptions?.query,
},
...forwardingArguments?.ApolloClient?.defaultOptions,
},
});
client.jwt_token = options.token;
client.path = options.path;
client.ssl = options.ssl;
return client;

hasura/README.md

Lines 1 to 84 in 202846e

[![npm](https://img.shields.io/npm/v/@deep-foundation/hasura.svg)](https://www.npmjs.com/package/@deep-foundation/hasura)
[![Gitpod](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/deep-foundation/hasura)
[![Discord](https://badgen.net/badge/icon/discord?icon=discord&label&color=purple)](https://discord.gg/deep-foundation)
# Usage
## Library
See [Documentation] for examples and API
## api
```ts
import { HasuraApi } from '@deep-foundation/hasura/api';
const api = new HasuraApi({
path: 'hasura.domain.com',
ssl: true,
secret: 'adminsecretkey'
});
```
> sql template literal for ide highlighting
```ts
import { sql } from '@deep-foundation/hasura/sql';
await api.sql(sql`SELECT * FROM mytable`);
```
[hasura api reference](https://hasura.io/docs/1.0/graphql/core/api-reference/schema-metadata-api/index.html)
```ts
await api.query({
type: 'track_table',
args: {
schema: 'public',
name: 'mytable',
}
});
```
## client
```ts
import { generateApolloClient } from '@deep-foundation/hasura/client';
import gql from 'graphql-tag';
const client = generateApolloClient({ // all options are optional
ws: true, // need to socket for subscriptions // recommended
secret: 'adminSecretForRoot', // admin secret for root access // not need when token exists
token: 'tokenFromCookiesOrLocalStorage', // token for auth webhook auth // ignored when secret exists
ssl: true; // auto http/https ws/wss protocol
path: 'hasura.domain.com/path', // link to hasura location
headers: {}, // custom additional fields into headers
initialStore: {},
relative: false, // optional
});
client.query({ query: gql`{ links { id }}` }).then(result => console.log(result))
```
If you need to specify an absolute path as `protocol://domain.zone/path` to hasura, you **must** pass these two options: `path` and `ssl`
```ts
const client = generateApolloClient({ // all options are optional
ssl: true;
path: 'hasura.domain.com/path',
});
```
If you need to specify relative path as `/path` to hasura, you must enable the relative mode with the `relative` option. In this case, the `ssl` option is ignored in `http` client, but used in `ws`. This can be useful when your build is with some proxy.
```ts
const client = generateApolloClient({ // all options are optional
relative: true,
path: 'hasura.domain.com/path',
});
```
You can also specify relative not locally in your code, but using an ENV variable `DEEP_FOUNDATION_HASURA_RELATIVE` or `NEXT_PUBLIC_DEEP_FOUNDATION_HASURA_RELATIVE`.
```sh
export DEEP_FOUNDATION_HASURA_RELATIVE = 1;
```
OR
```sh
export NEXT_PUBLIC_DEEP_FOUNDATION_HASURA_RELATIVE = 1;
```

hasura/package.json

Lines 1 to 47 in 202846e

{
"name": "@deep-foundation/hasura",
"version": "0.0.51",
"license": "Unlicense",
"author": "Ivan S Glazunov <[email protected]>",
"homepage": "https://github.com/deep-foundation/hasura",
"repository": {
"type": "git",
"url": "ssh://[email protected]/deep-foundation/hasura.git"
},
"description": "",
"dependencies": {
"@apollo/client": "^3.7.14",
"@apollo/react-hooks": "^4.0.0",
"@types/node": "^14.17.14",
"@types/react": "^18.2.15",
"apollo-boost": "^0.4.9",
"apollo-link": "^1.2.14",
"apollo-link-ws": "^1.0.20",
"apollo-server-micro": "^2.21.0",
"axios": "^0.21.1",
"babel-register": "^6.26.0",
"cors": "^2.8.5",
"debug": "^4.3.1",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"migrate": "^1.7.0",
"node-fetch": "^2.6.1",
"normalize-url": "^7.0.2",
"path": "^0.12.7",
"react": "^18.2.0",
"rimraf": "^3.0.2",
"ts-node": "^10.9.1",
"ws": "^7.5.6"
},
"scripts": {
"package:build": "npx tsc --project tsconfig.json",
"package:unbuild": "rimraf ./*.js && rimraf ./*.js.map && rimraf ./*.d.ts",
"package:publish": "npm run package:build && npm publish --access public && npm run package:unbuild",
"docker-local": "cd ./local && docker-compose -p deep up -d && cd ../",
"docker": "cross-env JWT_SECRET=\"{\\\"type\\\":\\\"HS256\\\",\\\"key\\\":\\\"3EK6FD+o0+c7tzBNVfjpMkNDi2yARAAKzQlk8O2IKoxQu4nF7EdAh8s3TwpHwrdWT6R\\\"}\" HASURA_GRAPHQL_DATABASE_URL=postgres://postgres:postgrespassword@postgres:5432/postgres HASURA_GRAPHQL_ENABLE_CONSOLE=true HASURA_GRAPHQL_DEV_MODE=true HASURA_GRAPHQL_LOG_LEVEL=debug HASURA_GRAPHQL_ENABLED_LOG_TYPES=\"startup, http-log, webhook-log, websocket-log, query-log\" HASURA_GRAPHQL_ADMIN_SECRET=myadminsecretkey HASURA_GRAPHQL_ENABLE_REMOTE_SCHEMA_PERMISSIONS=true HASURA_GRAPHQL_UNAUTHORIZED_ROLE=undefined POSTGRES_USER=postgres POSTGRES_PASSWORD=postgrespassword PGGSSENCMODE=disable PGSSLMODE=disable PGREQUIRESSL=0 MINIO_ROOT_USER=minioaccesskey MINIO_ROOT_PASSWORD=miniosecretkey HASURA_STORAGE_DEBUG=true HASURA_METADATA=1 HASURA_ENDPOINT=http://host.docker.internal:8080/v1 S3_ENDPOINT=http://host.docker.internal:9000 S3_ACCESS_KEY=minioaccesskey S3_SECRET_KEY=miniosecretkey S3_BUCKET=default S3_ROOT_FOLDER=default POSTGRES_MIGRATIONS=0 POSTGRES_MIGRATIONS_SOURCE=postgres://postgres:[email protected]:5432/postgres?sslmode=disable npm run docker-local"
},
"devDependencies": {
"cross-env": "^7.0.3",
"pre-commit": "^1.2.2",
"typescript": "5.0.4"
}

I also found the following external resources that might be helpful:

Summaries of links found in the content:

202846e:

The page is a GitHub commit from the repository 'deep-foundation/hasura'. The commit, titled 'Change npm-publish version to 4.0.1', was made by user 'FreePhoenix888' on September 6, 2023. The commit does not belong to any branch on this repository and may belong to a fork outside of the repository. The commit shows no changed files, additions, or deletions. There are no files selected for viewing and no comments on the commit. The page does not contain any code snippets or information relevant to the user's problem of modifying the usage of ApolloClient in 'client.tsx'.

): ApolloClient<any> {
:

The page contains the content of a file named client.tsx from the hasura repository owned by deep-foundation. The file is written in TypeScript (TSX) and primarily deals with the configuration and creation of an Apollo Client instance.

The Apollo Client is imported from the @apollo/client package. The file also imports other dependencies such as HttpLink, InMemoryCache, ApolloLink, concat, split from @apollo/client and WebSocketLink from apollo-link-ws.

The file defines two interfaces: IApolloClientGeneratorOptions and IApolloClient. The IApolloClientGeneratorOptions interface defines the shape of the options object that can be passed to the generateApolloClient function. The IApolloClient interface extends the ApolloClient class from the @apollo/client package and adds three optional properties: jwt_token, path, and ssl.

The generateApolloClient function is the main function in this file. It takes an options object of type IApolloClientGeneratorOptions and an optional forwardingArguments object. The function configures and returns a new instance of ApolloClient.

Here is the relevant code snippet:

import { HttpLink, InMemoryCache, ApolloClient } from '@apollo/client';
import { getMainDefinition } from '@apollo/client/utilities';
import { ApolloLink, concat, split } from 'apollo-link';
import { WebSocketLink } from 'apollo-link-ws';

export interface IApolloClientGeneratorOptions {
  initialStore?: any;
  token?: string;
  client?: string;
  secret?: string;
  ssl?: boolean;
  path?: string;
  headers?: any;
  ws?: boolean;
  relative?: boolean;
}

export interface IApolloClient extends ApolloClient {
  jwt_token?: string;
  path?: string;
  ssl?: boolean;
}

export function generateApolloClient(
  options: IApolloClientGeneratorOptions,
  forwardingArguments?: {
    ApolloClient?: any;
    InMemoryCache?: any;
  },
): ApolloClient {
  // function body
}

The user's problem is related to the usage of ApolloClient from @apollo/client. They suggest creating a custom ApolloClient type and using BaseApolloClient instead of new ApolloClient.


Step 2: ⌨️ Coding

• At the top of the file, import ApolloClient from '@apollo/client' as BaseApolloClient. • Create a new type called ApolloClient that extends the BaseApolloClient from '@apollo/client' and adds a 'path' property of type string, an 'ssl' property of type boolean, and a 'jwt_token' property of type string. • Replace the ApolloClient in the 'IApolloClient' interface with the new custom ApolloClient type. • Replace the ApolloClient in the return type of the 'generateApolloClient' function with the new custom ApolloClient type. • Replace the 'new ApolloClient' in the 'generateApolloClient' function with 'new BaseApolloClient'.

Step 3: 🔁 Code Review

Here are my self-reviews of my changes at sweep/custom-apollo-client-type.

Here is the 1st review

No changes required. The modifications in the `client.tsx` file are correct and align with the issue's requirements. The new `ApolloClient` type has been correctly defined and used throughout the file. Good job!

I finished incorporating these changes.


🎉 Latest improvements to Sweep:


💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request.
Join Our Discord

@kevinlu1248
Copy link

Hey, @FreePhoenix888 is it possible to access the logs for this on your end to check what the error message is? You can run docker logs NAME_OF_CONTAINER on the instance to access it.

@FreePhoenix888
Copy link
Member Author

FreePhoenix888 commented Sep 12, 2023

Hey, @FreePhoenix888 is it possible to access the logs for this on your end to check what the error message is? You can run docker logs NAME_OF_CONTAINER on the instance to access it.

Hi! Let me do what you have said here

@FreePhoenix888
Copy link
Member Author

sweep: Retry

2 similar comments
@FreePhoenix888
Copy link
Member Author

sweep: Retry

@FreePhoenix888
Copy link
Member Author

sweep: Retry

@FreePhoenix888
Copy link
Member Author

@kevinlu1248 ,

azureuser@deep-sweep:~$ docker logs b75c1adb91ae
PORT: 8080
8:C 12 Sep 2023 06:04:50.738 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
8:C 12 Sep 2023 06:04:50.738 # Redis version=7.0.11, bits=64, commit=00000000, modified=0, pid=8, just started
8:C 12 Sep 2023 06:04:50.738 # Configuration loaded
8:M 12 Sep 2023 06:04:50.738 * monotonic clock: POSIX clock_gettime
8:M 12 Sep 2023 06:04:50.738 * Running mode=standalone, port=6379.
8:M 12 Sep 2023 06:04:50.738 # Server initialized
8:M 12 Sep 2023 06:04:50.738 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
8:M 12 Sep 2023 06:04:50.738 * Ready to accept connections
INFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
INFO:     Started parent process [9]
Using environment: dev
GitHub app ID: 388031
Using Sandbox URL: http://sandbox-web:8080
Using environment: dev
GitHub app ID: 388031
Using Sandbox URL: http://sandbox-web:8080
Using environment: dev
GitHub app ID: 388031
Using Sandbox URL: http://sandbox-web:8080
Using environment: dev
GitHub app ID: 388031
Using Sandbox URL: http://sandbox-web:8080
Using environment: dev
GitHub app ID: 388031
Using Sandbox URL: http://sandbox-web:8080
The cache for model files in Transformers v4.22.0 has been updated. Migrating your old cache. This is a one-time only operation. You can interrupt this and resume the migration later on by calling `transformers.utils.move_cache()`.
0it [00:00, ?it/s]
INFO:     Started server process [18]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Started server process [17]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Started server process [15]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Started server process [16]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Started server process [19]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
2023-09-12 06:07:09.472 | INFO     | sweepai.api:webhook:175 - Received request: dict_keys(['action', 'issue', 'comment', 'repository', 'organization', 'sender', 'installation'])
2023-09-12 06:07:09.472 | INFO     | sweepai.api:webhook:180 - Received event: issue_comment, created
2023-09-12 06:07:09.474 | INFO     | sweepai.api:webhook:356 - New issue comment created
388031
INFO:     172.17.0.1:49202 - "POST / HTTP/1.1" 200 OK
https://github.com/deep-foundation/hasura/issues/8, False
2023-09-12 06:07:10.318 | INFO     | sweepai.handlers.on_ticket:on_ticket:300 - Getting repo deep-foundation/hasura
2023-09-12 06:07:11.385 | INFO     | sweepai.handlers.on_ticket:on_ticket:313 - Replying to comment 1715045036...
2023-09-12 06:07:11.772 | INFO     | sweepai.config.client:get_branch:117 - Error when getting branch: 404 {"message": "Not Found", "documentation_url": "https://docs.github.com/rest/repos/contents#get-repository-content"}, falling back to default branch
USERNAME deep-foundation-sweepai[bot]
COMMENT deep-foundation-sweepai[bot]
Found comment
COMMENT kevinlu1248
COMMENT deep-foundation-sweepai[bot]
Found comment
COMMENT kevinlu1248
COMMENT FreePhoenix888
COMMENT FreePhoenix888
COMMENT FreePhoenix888
COMMENT FreePhoenix888
2023-09-12 06:07:12.800 | WARNING  | sweepai.config.client:get_config:129 - Error when getting config: 404 {"message": "Not Found", "documentation_url": "https://docs.github.com/rest/repos/contents#get-repository-content"}, returning empty dict
2023-09-12 06:07:14.675 | INFO     | sweepai.handlers.on_ticket:on_ticket:590 - Fetching relevant files...
2023-09-12 06:07:14.675 | INFO     | sweepai.core.vector_db:get_relevant_snippets:322 - Getting query embedding...
2023-09-12 06:07:14.676 | INFO     | sweepai.core.vector_db:embed_texts:104 - Computing embeddings for 1 texts using sentence-transformers...
Batches: 100%|██████████| 1/1 [00:00<00:00, 14.76it/s]
2023-09-12 06:07:15.471 | INFO     | sweepai.core.vector_db:get_relevant_snippets:324 - Starting search by getting vector store...
2023-09-12 06:07:15.539 | INFO     | sweepai.api:webhook:175 - Received request: dict_keys(['action', 'changes', 'issue', 'comment', 'repository', 'organization', 'sender', 'installation'])
2023-09-12 06:07:15.540 | INFO     | sweepai.api:webhook:180 - Received event: issue_comment, edited
INFO:     172.17.0.1:34410 - "POST / HTTP/1.1" 200 OK
2023-09-12 06:07:15.862 | INFO     | sweepai.core.vector_db:get_deeplake_vs_from_repo:175 - Downloading repository and indexing for deep-foundation/hasura...
2023-09-12 06:07:15.863 | INFO     | sweepai.core.vector_db:get_deeplake_vs_from_repo:177 - Recursively getting list of files...
2023-09-12 06:07:15.863 | INFO     | sweepai.core.repo_parsing_utils:repo_to_chunks:66 - Reading files from cache/repos/deep-foundation/hasura/b059b4a6e0304d21be52ee156675a4486034f952447b744c15c123ce4f1726c2
2023-09-12 06:07:15.867 | INFO     | sweepai.core.repo_parsing_utils:repo_to_chunks:74 - Found 12 files
100%|██████████| 12/12 [00:00<00:00, 443.32it/s]
2023-09-12 06:07:15.895 | INFO     | sweepai.core.vector_db:get_deeplake_vs_from_repo:180 - Found 32 snippets in repository deep-foundation/hasura
2023-09-12 06:07:16.842 | INFO     | sweepai.core.vector_db:get_deeplake_vs_from_repo:211 - Found 12 files in repository deep-foundation/hasura
2023-09-12 06:07:16.844 | INFO     | sweepai.core.vector_db:get_deeplake_vs_from_repo:227 - Getting list of all files took 0.9806690216064453
2023-09-12 06:07:16.844 | INFO     | sweepai.core.vector_db:get_deeplake_vs_from_repo:228 - Received 32 documents from repository deep-foundation/hasura
2023-09-12 06:07:16.886 | INFO     | sweepai.core.vector_db:compute_deeplake_vs:243 - Computing embeddings with sentence-transformers...
2023-09-12 06:07:16.887 | INFO     | sweepai.core.vector_db:compute_deeplake_vs:261 - Found 0 embeddings in cache
2023-09-12 06:07:16.888 | INFO     | sweepai.core.vector_db:compute_deeplake_vs:267 - Computing 32 embeddings...
2023-09-12 06:07:16.888 | INFO     | sweepai.core.vector_db:embed_texts:104 - Computing embeddings for 32 texts using sentence-transformers...
Batches: 100%|██████████| 1/1 [00:01<00:00,  1.54s/it]
2023-09-12 06:07:18.752 | INFO     | sweepai.core.vector_db:compute_deeplake_vs:269 - Computed 32 embeddings
2023-09-12 06:07:18.753 | INFO     | sweepai.core.vector_db:compute_deeplake_vs:284 - Adding embeddings to deeplake vector store...
100%|██████████| 32/32 [00:00<00:00, 502.42it/s]
Dataset(path='cache/deeplake/a0cc6f6f0a47b73f39d88f52f7d659056ed180ed4f3f61a5821256270c3a877d', tensors=['text', 'metadata', 'embedding', 'id'])

  tensor      htype      shape     dtype  compression
  -------    -------    -------   -------  -------
   text       text      (32, 1)     str     None
 metadata     json      (32, 1)     str     None
 embedding  embedding  (32, 384)  float32   None
    id        text      (32, 1)     str     None
2023-09-12 06:07:18.829 | INFO     | sweepai.core.vector_db:compute_deeplake_vs:286 - Added embeddings to deeplake vector store
2023-09-12 06:07:18.830 | INFO     | sweepai.core.vector_db:compute_deeplake_vs:288 - Updating cache with 32 embeddings
2023-09-12 06:07:18.970 | INFO     | sweepai.core.vector_db:get_relevant_snippets:329 - Found 30 lexical results
2023-09-12 06:07:18.971 | INFO     | sweepai.core.vector_db:get_relevant_snippets:330 - Searching for relevant snippets... with 32 docs
2023-09-12 06:07:18.996 | INFO     | sweepai.core.vector_db:get_relevant_snippets:336 - Fetched relevant snippets...
2023-09-12 06:07:18.998 | INFO     | sweepai.core.vector_db:get_relevant_snippets:374 - Relevant paths: ['README.md', 'client.tsx', 'README.md', 'README.md', 'client.tsx']
2023-09-12 06:07:19.003 | INFO     | sweepai.utils.search_utils:search_snippets:51 - Snippets for query add ApolloClient type to client.tsx
https://github.com/deep-foundation/hasura/blob/947d587f3e53ccecf47b25fbfe5dc61fa43df321/client.tsx#L54 uses ApolloClient from @apollo/client, we should use our own `ApolloClient` type that should be created and should look like this:

import { ApolloClient as BaseApolloClient} from '@apollo/client';
export type ApolloClient = BaseApolloClient & {
path: string;
ssl: boolean;
}


Comments:

<comment username="kevinlu1248">
sweep: Retry
</comment>


<comment username="kevinlu1248">
Hey, @FreePhoenix888 is it possible to access the logs for this on your end to check what the error message is? You can run `docker logs NAME_OF_CONTAINER` on the instance to access it.
</comment>


<comment username="FreePhoenix888">
> Hey, @FreePhoenix888 is it possible to access the logs for this on your end to check what the error message is? You can run `docker logs NAME_OF_CONTAINER` on the instance to access it.

Hi! Let me do what you have said [here](https://discord.com/channels/1100625416022138902/1150671251371720754/1150864918434828328)
</comment>


<comment username="FreePhoenix888">

sweep: Retry


</comment>


<comment username="FreePhoenix888">
sweep: Retry
</comment>


<comment username="FreePhoenix888">

sweep: Retry


</comment>
: [Snippet(content='', start=90, end=120, file_path='README.md'), Snippet(content='', start=0, end=31, file_path='client.tsx'), Snippet(content='', start=120, end=150, file_path='README.md'), Snippet(content='', start=60, end=90, file_path='README.md'), Snippet(content='', start=53, end=133, file_path='client.tsx'), Snippet(content='', start=47, end=53, file_path='client.tsx'), Snippet(content='', start=31, end=47, file_path='client.tsx'), Snippet(content='', start=30, end=60, file_path='README.md'), Snippet(content='', start=0, end=30, file_path='LICENSE'), Snippet(content='', start=0, end=30, file_path='package.json'), Snippet(content='', start=0, end=68, file_path='api.tsx'), Snippet(content='', start=0, end=30, file_path='README.md'), Snippet(content='', start=0, end=763, file_path='remote-schema.tsx'), Snippet(content='', start=90, end=120, file_path='local/docker-compose.yml'), Snippet(content='', start=30, end=60, file_path='package.json'), Snippet(content='', start=0, end=83, file_path='compiler/index.js'), Snippet(content='', start=60, end=90, file_path='package.json'), Snippet(content='', start=120, end=150, file_path='local/docker-compose.yml'), Snippet(content='', start=60, end=90, file_path='local/docker-compose.yml'), Snippet(content='', start=30, end=60, file_path='local/docker-compose.yml'), Snippet(content='', start=90, end=120, file_path='package.json'), Snippet(content='', start=30, end=60, file_path='LICENSE'), Snippet(content='', start=0, end=30, file_path='local/docker-compose.yml'), Snippet(content='', start=0, end=759, file_path='auth-webhook.tsx'), Snippet(content='', start=180, end=210, file_path='local/docker-compose.yml')]

@FreePhoenix888
Copy link
Member Author

sweep: Retry

@kevinlu1248
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sweep Sweep your software chores
Projects
None yet
2 participants