Closed FreePhoenix888 closed 1 year ago
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 team@sweep.dev.
For bonus GPT-4 tickets, please report this bug on Discord.
🎉 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.
sweep: Retry
💎 Sweep Pro: I used GPT-4 to create this ticket. You have unlimited GPT-4 tickets. To retrigger Sweep, edit the issue.
I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.
I also found the following external resources that might be helpful:
Summaries of links found in the content:
https://github.com/deep-foundation/hasura/commit/202846e0e4a258a70af02fa96f66ae4fee9e5dd2:
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'.
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
.
client.tsx
✅ Commit 1564777
• 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'.
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
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.
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
sweep: Retry
sweep: Retry
sweep: Retry
@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
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')]
sweep: Retry
@FreePhoenix888 Btw does this look right? https://github.com/kevinlu1248/hasura/pull/2/files
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:Instead of using
new ApolloClient
usenew BaseApolloClient
(because new ApolloClient is just a type/interface, not a classChecklist
- [X] `client.tsx` ✅ Commit [`202846e`](https://github.com/deep-foundation/hasura/commit/202846e0e4a258a70af02fa96f66ae4fee9e5dd2)Checklist
- [X] `client.tsx` ✅ Commit [`1564777`](https://github.com/deep-foundation/hasura/commit/15647774edb2575e93f17db8334f1c9114b0f3e8)