پیکربندی اشتراکگذاری زمینه با فایلهای aiexclude، پیکربندی اشتراکگذاری زمینه با فایلهای aiexclude.
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
وقتی در Android Studio اشتراکگذاری زمینه پروژه خود را با Gemini انتخاب میکنید، میتوانید کنترل کنید که کدام فایلها بهطور خاص از پایگاه کد با استفاده از فایلهای .aiexclude
. به اشتراک گذاشته شوند. ویژگیهای هوش مصنوعی در Android Studio نمیتوانند به فایلهای خارج از پروژه فعلی و ریشههای کنترل نسخه متصل به آن دسترسی داشته باشند. با در نظر گرفتن این موضوع، میتوانید فایلهای .aiexclude
را در هر جایی از پروژه و ریشههای VCS آن قرار دهید تا کنترل کنید که ویژگیهای هوش مصنوعی به کدام فایلها اجازه دسترسی دارند.
مانند یک فایل .gitignore
، یک فایل .aiexclude
فایل هایی را که نباید با Gemini در Android Studio به اشتراک گذاشته شوند، از جمله تجربه چت و همچنین ویژگی های هوش مصنوعی که در ویرایشگر کار می کنند، مانند تکمیل کد ، ردیابی می کند. یک فایل .aiexclude
بر روی فایل هایی که در دایرکتوری حاوی آن یا زیر آن قرار دارند عمل می کند.

نحوه نوشتن فایل های .aiexclude
یک فایل .aiexclude
از دستور یک فایل .gitignore
پیروی می کند.
نمونه ها
در اینجا نمونه ای از تنظیمات فایل .aiexclude
است:
- الگوی
KEYS
همه فایلهایی به نام "KEYS" را بدون پسوند فایل در دایرکتوری حاوی فایل .aiexclude
. یا زیر آن مسدود میکند.
KEYS
- الگوی
KEYS.*
همه فایلهایی به نام "KEYS" را با هر پسوند فایل در یا زیر دایرکتوری که حاوی . فایل aiexclude
KEYS.*
- الگوی
*.kt
همه فایلهای Kotlin یا فایلهایی با پسوند .kt
را در دایرکتوری حاوی فایل .aiexclude
یا زیر آن مسدود میکند.
*.kt
- الگوی
/*.kt
همه فایلهای .kt
را در پوشه .aiexclude
مسدود میکند، اما نه در زیر.
/*.kt
- الگوی
my/sensitive/dir/
همه فایلهای موجود در فهرست my/sensitive/dir
و زیر را مسدود میکند. مسیر فایل نسبت به دایرکتوری حاوی فایل .aiexclude
است.
my/sensitive/dir/
- الگوی
my/sensitive/dir/**/.txt
همه فایلهای .txt
را در دایرکتوری my/sensitive/dir/
یا زیر آن مسدود میکند.
my/sensitive/dir/**/.txt
- الگوی
my/sensitive/dir/*.txt
همه فایلهای .txt
را در دایرکتوری my/sensitive/dir
مسدود میکند، اما نه در زیر شاخهها.
my/sensitive/dir/*.txt
محتوا و نمونه کدها در این صفحه مشمول پروانههای توصیفشده در پروانه محتوا هستند. جاوا و OpenJDK علامتهای تجاری یا علامتهای تجاری ثبتشده Oracle و/یا وابستههای آن هستند.
تاریخ آخرین بهروزرسانی 2025-07-31 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-31 بهوقت ساعت هماهنگ جهانی."],[],[],null,["# Configure context sharing with .aiexclude files\n\nWhen you opt in to sharing your project context with Gemini in Android Studio,\nyou can control which files specifically from the codebase are shared using\n`.aiexclude` files. AI features in Android Studio cannot access files outside of\nthe current project and the version control roots attached to it. With this in\nmind, you can place `.aiexclude` files anywhere within the project and its VCS\nroots to control which files AI features are allowed to access.\n\nMuch like a `.gitignore` file, an `.aiexclude` file tracks files that shouldn't\nbe shared with Gemini in Android Studio, including the chat experience as well\nas AI features that operate in the editor, like [code completion](/studio/gemini/code-completion). An\n`.aiexclude` file operates on files at or below the directory that contains it.\n\nHow to write `.aiexclude` files\n-------------------------------\n\nAn `.aiexclude` file follow the same syntax as a\n[`.gitignore` file](https://git-scm.com/docs/gitignore).\n\nExamples\n--------\n\nHere are example `.aiexclude` file configurations:\n\n- The pattern `KEYS` blocks all files called \"KEYS\" with no file extension at or below the directory that contains the `.aiexclude` file.\n\n KEYS\n\n- The pattern `KEYS.*` blocks all files called \"KEYS\" with any file extension at or below the directory that contains the .`aiexclude` file.\n\n KEYS.*\n\n- The pattern `*.kt` blocks all Kotlin files, or files with the extension `.kt`, at or below the directory that contains the `.aiexclude` file.\n\n *.kt\n\n- The pattern `/*.kt` blocks all `.kt` files in the `.aiexclude` directory, but not below.\n\n /*.kt\n\n- The pattern `my/sensitive/dir/` blocks all files in the `my/sensitive/dir` directory and below. The file path is relative to the directory that contains the `.aiexclude` file.\n\n my/sensitive/dir/\n\n- The pattern `my/sensitive/dir/**/.txt` blocks all `.txt` files at or below the directory `my/sensitive/dir/`.\n\n my/sensitive/dir/**/.txt\n\n- The pattern `my/sensitive/dir/*.txt` blocks all `.txt` files in the directory `my/sensitive/dir`, but not in sub-directories.\n\n my/sensitive/dir/*.txt"]]