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

WIP: Feat/chat links #213

Merged
merged 88 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
0bfde52
wip(integrations): add service for the api.
MarcMcIntosh Nov 6, 2024
81c8b6d
fix(integrations): add _ to unused function argument.
MarcMcIntosh Nov 6, 2024
281568d
wip(integrations): add enabled feild.
MarcMcIntosh Nov 6, 2024
777d4a0
chore(types): update integration fixture
MarcMcIntosh Nov 6, 2024
e8bd52f
Merge branch 'alpha' into integrations-api
MarcMcIntosh Nov 6, 2024
af79cde
wip: integrations page layout + data retrieval
alashchev17 Nov 6, 2024
780268b
wip: conditional rendering of form and cards & JSON schema parsing in…
alashchev17 Nov 7, 2024
a8abf89
wip: customized form & updating data
alashchev17 Nov 10, 2024
18e1383
wip: icon in title & overall enhancements
alashchev17 Nov 12, 2024
1b8838a
wip: renamed buttons
alashchev17 Nov 12, 2024
6606f83
Merge branch 'alpha' into integrations-api
MarcMcIntosh Nov 18, 2024
e45d3dd
wip(integration api): update response types.
MarcMcIntosh Nov 18, 2024
ffb8c21
Merge remote-tracking branch 'origin/integrations-api-self-configure'…
alashchev17 Nov 18, 2024
be2e6a2
wip: ajv & rjsf libraries removal
alashchev17 Nov 18, 2024
86238ee
wip(intergrations api): add save handler.
MarcMcIntosh Nov 18, 2024
a62056e
Merge branch 'integrations-api-self-configure' into feat/setup-integr…
alashchev17 Nov 18, 2024
04568e8
fix(integrations): typo in types
MarcMcIntosh Nov 18, 2024
308c944
wip: fixing endpoints & new hooks for data fetching
alashchev17 Nov 18, 2024
8a3f592
fix(integrations): typos.
MarcMcIntosh Nov 18, 2024
d28f00f
fix: type guards conditions
alashchev17 Nov 19, 2024
d027e8c
wip(integrations UI): grouping integrations on global, project specific
alashchev17 Nov 19, 2024
89524ed
wip(integrations): schema parsing & refactoring
alashchev17 Nov 20, 2024
2647fc9
wip: rendering values & LSP responses handling
alashchev17 Nov 21, 2024
3bfaf7c
Wip smart links button (#206)
MarcMcIntosh Nov 21, 2024
9920261
wip: smartlinks within fields & return to integraitons page from chat
alashchev17 Nov 21, 2024
f0ac48a
wip(integrations): availability
alashchev17 Nov 22, 2024
8176ab9
wip: return button alignment
alashchev17 Nov 22, 2024
a660bbd
Merge branch 'alpha' into integrations-api-self-configure
alashchev17 Nov 22, 2024
9ea4cb5
Merge branch 'alpha' into integrations-api-self-configure
alashchev17 Nov 22, 2024
e05442a
Merge branch 'integrations-api-self-configure' into feat/setup-integr…
alashchev17 Nov 22, 2024
d987924
wip: form disabled if values didn't change
alashchev17 Nov 22, 2024
c8c7190
wip: better UI & cancel values of form
alashchev17 Nov 25, 2024
7a1d62b
wip: header for integrations & better layout & availability
alashchev17 Nov 25, 2024
ec026bd
wip: field.f_type -> [f_type, f_size]
alashchev17 Nov 26, 2024
bd870a3
wip: docker containers api handlers
alashchev17 Nov 26, 2024
514397f
wip: docker actions API & action buttons
alashchev17 Nov 27, 2024
201f29b
wip: better action handling
alashchev17 Nov 27, 2024
8eea732
wip: simplification of dockerApi & action buttons improvements
alashchev17 Nov 27, 2024
a2b8e42
chore: fixtures update
alashchev17 Nov 27, 2024
00874fd
chore: removal of unnecessary esling rule bypass
alashchev17 Nov 27, 2024
f09ef28
wip: docker container card & refactoring of integration form
alashchev17 Nov 28, 2024
cd356d1
wip: form cancel removed & smartlinks on the right side of form buttons
alashchev17 Nov 28, 2024
857da33
WIP: Refactor/integration chat (#209)
MarcMcIntosh Nov 28, 2024
edc071f
Merge branch 'feat/setup-integrations' into feat/docker-api
alashchev17 Nov 28, 2024
9a785c6
feat(configuration): adjusted size of inputs based on f_size & DataLi…
alashchev17 Nov 28, 2024
141e695
fix(config chat): reuse last model and system prompt
MarcMcIntosh Nov 29, 2024
7f9e791
Merge branch 'feat/setup-integrations' into feat/docker-api
alashchev17 Nov 29, 2024
d46e9fd
wip: form appearance & responsive layout
alashchev17 Nov 29, 2024
2549fc1
wip: updated docker section
alashchev17 Nov 29, 2024
9104122
wip(refactoring): smartlink, availability, renderField, handleSmartli…
alashchev17 Nov 29, 2024
011857d
wip(chat links): add stub api for chat links.
MarcMcIntosh Nov 29, 2024
b9c0d37
wip(chat-links): setup story book.
MarcMcIntosh Nov 29, 2024
2830a8b
wip(chat links): add a quick ui to run in sotrybook
MarcMcIntosh Nov 29, 2024
91c3a48
chore(chat links): add todos.
MarcMcIntosh Nov 29, 2024
eaaaf2c
wip(chat links): add arguments to request handler and use msw in stor…
MarcMcIntosh Dec 2, 2024
2f32a14
chore(chat links): update lsp url.
MarcMcIntosh Dec 2, 2024
61868f9
ui(chat link title): add a information about the link in the title.
MarcMcIntosh Dec 2, 2024
7f5ac29
Merge branch 'feat/setup-integrations' into feat/chat-links
MarcMcIntosh Dec 2, 2024
b573ddd
wip(chat links): add chat links component to chat content.
MarcMcIntosh Dec 2, 2024
74dcc6b
Merge branch 'feat/docker-api' into feat/chat-links
MarcMcIntosh Dec 2, 2024
75bddd9
refactor(chat action types): enum couldn't be used for comparison :/
MarcMcIntosh Dec 2, 2024
fd72628
fix(chat config cations): go back to integration.
MarcMcIntosh Dec 2, 2024
92ad2e6
fix(chat config): go to action should open a configuration.
MarcMcIntosh Dec 2, 2024
4f8ff72
chore(storybook): add config story to chat content.
MarcMcIntosh Dec 2, 2024
a406bb8
ui(configuration chat): adjust size and spacing of the available acti…
MarcMcIntosh Dec 2, 2024
5c5ac7f
wip(chat actions): comment out unhandled if statments.
MarcMcIntosh Dec 2, 2024
4649afe
chore(links api): add model name to the links request.
MarcMcIntosh Dec 3, 2024
6f66114
fix(links request): model name must be defined.
MarcMcIntosh Dec 3, 2024
eec11f1
wip(config chat): add notes about action handlers.
MarcMcIntosh Dec 3, 2024
d718260
Feature: Docker Containers API (#210)
alashchev17 Dec 3, 2024
906fe65
chore: endpoints extraction to consts & TODO insertion for cache inva…
alashchev17 Dec 3, 2024
d3f35e4
fix: padding shift issue & middleware for detail error on integration…
alashchev17 Dec 4, 2024
aef03b2
Merge branch 'feat/setup-integrations' into feat/chat-links
MarcMcIntosh Dec 4, 2024
a77bf8c
refactor(chat meta): add meta info to chat request.
MarcMcIntosh Dec 4, 2024
4dbac52
fix(fixtures): update configuration chat fixture.
MarcMcIntosh Dec 4, 2024
26ffb45
feat: show links for all chats.
MarcMcIntosh Dec 4, 2024
bf0f6f6
chore(links meta): add meta to links.
MarcMcIntosh Dec 4, 2024
b99762e
fix: linter error.
MarcMcIntosh Dec 4, 2024
c6102b2
feat(chat links): handle follow up action.
MarcMcIntosh Dec 4, 2024
8d12f16
hard code links mode to explore.
MarcMcIntosh Dec 4, 2024
832b474
feat(system message): request the system message with the chat stream.
MarcMcIntosh Dec 5, 2024
c921454
WIP(chat links): pass mode through follow-up and summarise project li…
MarcMcIntosh Dec 5, 2024
f4466a4
wip(chat links): infer the mode in none is added.
MarcMcIntosh Dec 5, 2024
49148e8
Merge branch 'alpha' into feat/chat-links
MarcMcIntosh Dec 5, 2024
fd2ef2d
fix: don't set deterministic messages when there isn't a system message.
MarcMcIntosh Dec 5, 2024
05be5b1
wip(system message): don't user deterministic messages because it sto…
MarcMcIntosh Dec 5, 2024
6e4a384
fix(chat meta links): set mode to the correct string.
MarcMcIntosh Dec 5, 2024
afec786
fix(chat links): show on new chat.
MarcMcIntosh Dec 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
471 changes: 471 additions & 0 deletions src/__fixtures__/chat_config_thread.ts

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions src/__fixtures__/chat_links_response.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { LinksForChatResponse } from "../services/refact/links";

export const STUB_LINKS_FOR_CHAT_RESPONSE: LinksForChatResponse = {
links: [
{
text: "Save and return",
action: "patch-all",
goto: "SETTINGS:/path/to/config/file.yaml",
},
{ text: "Can you fix it?", action: "follow-up" },
{ text: 'git commit -m "message"', action: "commit" },
{ text: "Save and return", goto: "SETTINGS:postgres" },
{ text: "Investigate Project", action: "summarize-project" },
],
};
2 changes: 2 additions & 0 deletions src/__fixtures__/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ export * from "./context_files";
export * from "./prompts";
export * from "./integrations";
export * from "./survey_questions";
export * from "./chat_links_response";
export * from "./chat_config_thread";
3 changes: 3 additions & 0 deletions src/app/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import { informationSlice } from "../features/Errors/informationSlice";
import { confirmationSlice } from "../features/ToolConfirmation/confirmationSlice";
import { attachedImagesSlice } from "../features/AttachedImages";
import { userSurveySlice } from "../features/UserSurvey/userSurveySlice";
import { linksApi } from "../services/refact/links";
import { integrationsSlice } from "../features/Integrations";

const tipOfTheDayPersistConfig = {
Expand Down Expand Up @@ -77,6 +78,7 @@ const rootReducer = combineSlices(
[smallCloudApi.reducerPath]: smallCloudApi.reducer,
[pathApi.reducerPath]: pathApi.reducer,
[pingApi.reducerPath]: pingApi.reducer,
[linksApi.reducerPath]: linksApi.reducer,
},
historySlice,
errorSlice,
Expand Down Expand Up @@ -149,6 +151,7 @@ export function setUpStore(preloadedState?: Partial<RootState>) {
diffApi.middleware,
smallCloudApi.middleware,
pathApi.middleware,
linksApi.middleware,
integrationsApi.middleware,
dockerApi.middleware,
)
Expand Down
37 changes: 29 additions & 8 deletions src/components/ChatContent/ChatContent.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,29 @@ import { setUpStore } from "../../app/store";
import { Theme } from "../Theme";
import { AbortControllerProvider } from "../../contexts/AbortControllers";
import { MarkdownMessage } from "../../__fixtures__/markdown";
import { ChatMessages } from "../../events";
import { ChatMessages, ChatThread } from "../../events";
import {
CHAT_FUNCTIONS_MESSAGES,
CHAT_WITH_DIFF_ACTIONS,
CHAT_WITH_DIFFS,
FROG_CHAT,
LARGE_DIFF,
CHAT_WITH_MULTI_MODAL,
CHAT_CONFIG_THREAD,
STUB_LINKS_FOR_CHAT_RESPONSE,
} from "../../__fixtures__";
import { http, HttpResponse } from "msw";
import { CHAT_LINKS_URL } from "../../services/refact/consts";

const MockedStore: React.FC<{
messages: ChatMessages;
}> = ({ messages }) => {
messages?: ChatMessages;
thread?: ChatThread;
}> = ({ messages, thread }) => {
const threadData = thread ?? {
id: "test",
model: "test",
messages: messages ?? [],
};
const store = setUpStore({
chat: {
streaming: false,
Expand All @@ -29,11 +39,7 @@ const MockedStore: React.FC<{
error: null,
cache: {},
system_prompt: {},
thread: {
id: "test",
model: "test",
messages,
},
thread: threadData,
},
});

Expand Down Expand Up @@ -119,3 +125,18 @@ export const MultiModal: Story = {
messages: CHAT_WITH_MULTI_MODAL.messages,
},
};

export const IntegrationChat: Story = {
args: {
thread: CHAT_CONFIG_THREAD.thread,
},
parameters: {
msw: {
handlers: [
http.post(CHAT_LINKS_URL, () => {
return HttpResponse.json(STUB_LINKS_FOR_CHAT_RESPONSE);
}),
],
},
},
};
13 changes: 9 additions & 4 deletions src/components/ChatContent/ChatContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { GroupedDiffs } from "./DiffContent";
import { ScrollToBottomButton } from "./ScrollToBottomButton";
import { currentTipOfTheDay } from "../../features/TipOfTheDay";
import { popBackTo } from "../../features/Pages/pagesSlice";
import { ChatLinks } from "../ChatLinks";

const TipOfTheDay: React.FC = () => {
const tip = useAppSelector(currentTipOfTheDay);
Expand Down Expand Up @@ -150,22 +151,23 @@ export const ChatContent: React.FC<ChatContentProps> = ({
};

const handleReturnToConfigurationClick = useCallback(() => {
// eslint-disable-next-line no-console
console.log(`[DEBUG]: going back to configuration page`);
// console.log(`[DEBUG]: going back to configuration page`);
// TBD: should it be allowed to run in the background?
onStopStreaming();
dispatch(
popBackTo({
name: "integrations page",
projectPath: thread.integration?.path,
projectPath: thread.integration?.project,
integrationName: thread.integration?.name,
integrationPath: thread.integration?.path,
}),
);
}, [
onStopStreaming,
dispatch,
thread.integration?.project,
thread.integration?.name,
thread.integration?.path,
onStopStreaming,
]);

const handleSaveAndReturn = useCallback(async () => {
Expand All @@ -187,6 +189,9 @@ export const ChatContent: React.FC<ChatContentProps> = ({
<Flex direction="column" className={styles.content} p="2" gap="1">
{messages.length === 0 && <PlaceHolderText />}
{renderMessages(messages, onRetryWrapper)}

<ChatLinks />

<Container py="4">
<Spinner spinning={isWaiting} />
</Container>
Expand Down
Empty file.
53 changes: 53 additions & 0 deletions src/components/ChatLinks/ChatLinks.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { Meta, StoryObj } from "@storybook/react";

import { ChatLinks } from "./ChatLinks";
import { setUpStore } from "../../app/store";
import { Provider } from "react-redux";
import { Theme } from "../Theme";
import { Container } from "@radix-ui/themes";
import { http, HttpResponse, type HttpHandler } from "msw";
import { CHAT_LINKS_URL } from "../../services/refact/consts";
import {
STUB_LINKS_FOR_CHAT_RESPONSE,
CHAT_CONFIG_THREAD,
} from "../../__fixtures__";

const Template = () => {
const store = setUpStore({
chat: CHAT_CONFIG_THREAD,
});
return (
<Provider store={store}>
<Theme>
<Container p="4">
<ChatLinks />
</Container>
</Theme>
</Provider>
);
};

const meta = {
title: "Components/ChatLinks",
component: Template,
argTypes: {
//...
},
parameters: {
msw: {
handlers: [
http.post(CHAT_LINKS_URL, () => {
return HttpResponse.json(STUB_LINKS_FOR_CHAT_RESPONSE);
}),
],
},
},
} satisfies Meta<
typeof Template & { parameters: { msw: { handlers: HttpHandler[] } } }
>;

export default meta;

type Story = StoryObj<typeof meta>;

export const Default: Story = {};
Loading
Loading